The text in all XML documents will be parsed by the parser. Only the text in CDATA section (CDATAsection) will be neglected by the parser. ParsedDataXML parser parses all the text in the XML document. When an XML element is parsed
The text in all XML documents will be parsed by the parser.
Only the text in the CDATA section is neglected by the parser.
Parsed Data
The XML parser parses all the text in the XML document.
When an XML element is parsed, the text between tags is also parsed:
This article will also be parsed
The parser does this because the XML element can contain other elements, just like The element contains two other elements (first and last ):
Bill
Gates
The parser will break it into sub-elements like this:
Bill
Gates
Escape characters
Invalid XML characters must be replaced with entity reference ).
If you place a character in an XML document, such as '<', this document produces an error because the parser will describe it as the beginning of a new element. Therefore, you cannot write as follows:
if salary < 1000 then
To avoid this error, you need to replace '<' with an object reference, as shown in the following figure:
if salary < 1000 then
There are 5 predefined entity references in XML:< <小于> > Ampersands (&) and ampersands (&) are enclosed in quotation marks (').
Note:Strictly speaking, it is invalid to have only the characters '<' and '&' in XML. Ellipsis, quotation marks, and greater than signs are justified, but it is a good habit to replace them with entity references.
CDATA
Everything inside CDATA is neglected by the parser.
Assume that your text contains a large number of '<' and '&' characters, just as it is often displayed in programming code-then this XML element can be defined as a CDATA.
CDATA section begins''</EM>,结束于<EM>'':
《script》function matchwo(a,b){if (a < b && a < 0) then { return 1 }else { return 0 }}《script》
In the preceding example, everything in the CDATA section is neglected by the parser.
CDATA section comment:
CDATA segments cannot contain strings ']>'. Therefore, CDATA segments cannot be embedded.
At the same time, make sure that there are no spaces or lines in the ']>' string.