What is the use of CDATA in XML
This article is to share with you about the use of CDATA in XML. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
All text in the XML document is parsed by the parser.
Only text within the CDATA widget is ignored by the parser.
Parsing data
XML parsers typically process all text in an XML document.
When the XML element is parsed, the text inside the XML element is also parsed:
This text is also parsed
The reason the XML parser does this is that there may be other elements inside the XML element, as in the following example, the name element contains first and last elements:
BillGates
The parser will think that the above code looks like this:
Bill Gates
Escape character
Illegal XML characters must be replaced with corresponding entities.
If you use something like "" or "" in an XML document, there are no spaces or line breaks between them.
Thank you for reading! This is the end of this article on "what is the use of CDATA in XML?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!