Detailed introduction to XML Special characters

Source: Internet
Author: User
ApprovalSetting: If "& lt; br & gt;" is entered in Approver_Role, what error occurs when applying for the form, because & lt; is encountered when combining XML strings ;. Escape. Special characters in ServiceForFlowER. cs Approval Setting:

If Approver_Role inputs"
", So what error occurred when applying for the form, because the XML string was encountered <. Escape.

ServiceForFlowER. cs

approvalXML += ""                            + "" + GetEmpID(approverTable.Rows[i][entityApprover.Approver.PhysicalFieldName].ToString()) + ""                            + "
 
  " + approverTable.Rows[i][entityApprover.ApprovalOrder.PhysicalFieldName].ToString() + "
 "                            + "" + approverTable.Rows[i][entityApprover.Role.PhysicalFieldName].ToString() + ""                            + "";

PS:

InvalidXMLThe character must be replaced with the corresponding entity.

If you use a character similar to "<" in the XML document, the parser will encounter an error because the parser considers this as the beginning of a new element. Therefore, the code should not be written as follows:

     
      if salary < 1000 then
     

To avoid this situation, you must convert the character "<" to an object, as shown below:

     
      if salary < 1000 then
     

The following are five pre-defined entities in the XML document:

<

<

Yu No.

>

>

Yu No.

&

&

And

'

'

Single quotes

"

"

Double quotation marks


The object must start with the symbol "&" and end with the symbol ";".

Note:Only the "<" and "&" characters are strictly forbidden for XML. The rest are legal. it is a good habit to use entities to reduce errors.

The above is a detailed description of the special characters in XML. For more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.