I often find this strange CDATA
tag in XML
files:
<![CDATA[some stuff]]>
I have observed that this CDATA
tag always comes at the beginning, and then followed by some stuff.
But sometimes it is used, sometimes it is not. I assume it is to mark that some stuff
is the "data" that will be inserted after that. But what kind of data is some stuff
? Isn't anything I write in XML tags some sort of data?
Best Answer
CDATA stands for Character Data and it means that the data in between these strings includes data that could be interpreted as XML markup, but should not be.
The key differences between CDATA and comments are:
]]>
(CDEnd
), while in a comment--
is invalid.This means given these four snippets of XML from one well-formed document: