Home > Article > Backend Development > XML Guide - XML CDATA
All text in the XML document will be parsed by the parser.
Only text within the CDATA component will be ignored by the parser.
---------------------------------------- ---------------------------------------
Analytical data
XML parsers typically process all text in an XML document.
When the XML element is parsed, the text inside the XML element will also be parsed:
<message>This text is also parsed</message>
The reason why the XML parser does this is that there may be other text inside the XML element. Contains other elements, like the example below, the name element contains two elements: first and last:
<name><first>Bill</first><last>Gates</last></name>
The parser will think that the above code is like this:
<name> <first>Bill</first> <last>Gates</last> </name>
---------------------------------- -----------------------------------------------
Escape characters
Illegal XML characters must be replaced with corresponding entities.
If you use characters like "2296ff891d22f945a3de87403f027871 > Greater than sign
& & and
' ' Single quotation mark
" " Double quotation mark
The entity must start with the symbol "&" and end with the symbol ";".
Note: Only the "224848bf6a08e2aef1ae53b3dcd0c5b6" tag:
<script> <![CDATA[ function matchwo(a,b) { if (a < b && a < 0) then { return 1 } else { return 0 } } ]]> </script>
In front of In this example, all text between CDATA components will be ignored by the parser.
CDATA Notes:
CDATA components can no longer contain CDATA components (cannot be nested). If the CDATA component contains the characters "]]>" or "aebf04653d22bc1ab16fb104651aed19".
The above is the content of XML Guide-XML CDATA. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!