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.