XMLCDATA
All text in an XML document is parsed by the parser.
Only text within a CDATA section is ignored by the parser.
PCDATA - Parsed Character Data
XML parsers typically parse all text in an XML document.
When an XML element is parsed, the text between its tags is also parsed: This text is also parsed
</message>
Parsers do this because XML elements can contain other elements, as in this example where the <name> element contains two other elements (first and last):
The parser breaks it down into sub-elements like this:
Parsed Character Data (PCDATA) is the term used for text data parsed by XML parsers.
CDATA - (Unparsed) Character Data
The term CDATA refers to text data that should not be parsed by the XML parser.
Characters like "<" and "&" are illegal in XML elements.
"<" causes an error because the parser interprets it as the start of a new element.
"&" causes an error because the parser interprets it as the start of a character entity.
Certain text, such as JavaScript code, contains many "<" or "&" characters. To avoid errors, script code can be defined as CDATA.
All content within a CDATA section is ignored by the parser.
A CDATA section starts with "" and ends with "]]>":
In the above example, the parser ignores all content within the CDATA section.
Notes on CDATA Sections:
CDATA sections cannot contain the string "]]>". Nested CDATA sections are not allowed.
The "]]>" marking the end of a CDATA section cannot contain spaces or line breaks.