This requires the use of XML CDATA
All text in the XML document will be parsed by the parser.
Only the text in the CDATA part is ignored by the parser.
Parse data
The XML Parser usually processes all text in the XML document.
When an XML element is parsed, the text inside the XML element is also parsed:
<Message> This text is also parsed </message>
The XML parser does this because the XML element may also contain other elements. In the following example, the name element contains the first and last elements:
<Name> <first> Bill </first> <last> Gates </last> </Name>
The parser will consider the aboveCodeYes:
<Name>
<First> Bill </first>
<Last> Gates </last>
</Name>
Escape Character
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:
If salary <1000 then
to avoid this situation, the character "<" must be converted to an object, as shown below:
If salary <1000 then
The following are five objects pre-defined in the XML document:
greater than
&
''single quotation marks
" "Double quotation marks
the entity must be signed "&" start, 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.
CDATA part
all content in CDATA is ignored by the parser.
If the text contains many "<" characters and "&" characters -- like the Program code, so we 'd better put them all in the CDATA component.
a CDATA part starts with " "mark:
in the previous example, all texts between CDATA components are ignored by the parser.
CDATA considerations:
CDATA components cannot be nested ). If the CDATA part contains the character "]>" or " note that there is no space or line break between the string "]>.