The term CDATA means, Character Data. CDATA are defined as blocks of text that are not parsed by the parser, but are otherwise recognized as markup.
The predefined entities such as <, >, and & require typing and are generally difficult to read in the markup. In such cases, CDATA section can be used. By using CDATA section, you are commanding the parser that the particular section of the document contains no markup and should be treated as regular text.
Following is the syntax for CDATA section:
characters with markup
The above syntax is composed of three sections:
CDATA Start section - CDATA begins with the nine-character delimiter <![CDATA[
CDATA End section - CDATA section ends with ]]> delimiter.
CData section - Characters between these two enclosures are interpreted as characters, and not as markup. This section may contain markup characters (<, >, and &), but they are ignored by the XML processor.
The following markup code shows example of CDATA. Here, each character written inside the CDATA section is ignored by the parser.
<message> Welcome to StudyHost </message>
In the above syntax, everything between and is treated as character data and not as markup.
The given rules are required to be followed for XML CDATA:
CDATA cannot contain the string "]]>" anywhere in the XML document.
Nesting is not allowed in CDATA section.