Escape characters in HTML XML

Source: Internet
Author: User

From http://www.cnblogs.com/jialine/archive/2006/10/12/527736.html

HtmlEscape characters in

 

 

<,>, & And so on in HTML have special meanings. (the first two characters are used for the link sign and "escape" characters. When these three characters are used, their escape sequences should be used, as shown below:

& Amp; or &

&

And

& Lt; or <

<

 

 

Yu no.

& Gt; or>

>

 

 

Yu no.

& Quot;

"

Double quotation marks

 

& Nbsp;

 

 

Space

& Copy;

Copyright token

& Reg

 

 

Register character

           

The former is the character escape sequence, and the latter is the numerical escape sequence. Convert the number to the ASCII value corresponding to the character. For example, & lt; font & gt; is displayed as, <font>. If it is written directly, it is considered as a link signature.

Note:

A. There cannot be spaces between characters in the escape sequence;

 

 

B. The escape sequence must end;

 

 

C. Separate & not considered as the start of escape;

 

 

D. case sensitive.

Another character that needs to be escaped is a quotation mark. Its Turn-to-order column is "or """

The character set used by HTML is the iso & 859 Larin-1 character set, which contains many characters that cannot be entered on the standard keyboard. Only escape sequences can be used for these special characters.

 

XML escape characters

 

 

Invalid xml characters must be replaced with corresponding entities.

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:

<Message> If salary <1000 then </message>

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

<Message> If salary <1000 then </message>

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

& Lt;

<

 

 

Yu no.

& Gt;

>

 

 

Yu no.

& Amp;

&

And

& Apos;

'

Single quotes

& Quot;

"

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.

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.