Special XML Character Processing

Source: Internet
Author: User
Tags xml attribute

In XML, some symbols are used as the markup symbols of XML. In some cases, attribute values must carry these special symbols. The following describes how to process common special symbols.

Example 1: Use double quotation marks.

Double quotation marks are the start and end symbols of XML Attribute values. Therefore, you cannot directly use "" In values. There are two processing methods.

A: The attribute value does not contain '(single quotes). You can use' as the start and end symbol of the attribute value.

< Add Key = " IPhone " Value = "Apple" />... The property value is ("apple ").

solution: Add key = " iPhone " value =' " apple "' />

B: The attribute values include '(single quotation marks) and double quotation marks. For example... The property value is ("'apple ").

< Add Key = " IPhone " Value = "& Quot;& Apos;Apple& Quot;" />

The following table lists five built-in entities for the characters used by the XML tag.

Entity Entity reference Description


& Lt;

<(Yu no)


& Gt;

> (Greater than the number)


& Amp;

& ("And)


& Apos;

'(Apostrophes or single quotes)


& Quot;

"(Double quotation marks)

If the character may cause the XML analyzer to incorrectly interpret the document structure, use an object instead of a character.& Apos;And& Quot;Object references are most commonly used in attribute values.

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.