XML - Character data (CDATA) - Escape


All text that is not markup or comment constitutes the character data of the document (CDATA).

The CDATA token may be used to define text that must not be parsed.

CDATA is just like PCDATA, except the parser will not expect child XML content to be embedded in it.


CDATA sections are used to escape blocks of text containing characters which would otherwise be recognized as markup.

CDATA sections may occur anywhere character data may occur


CDATA sections:

  • begin with the string <![CDATA[
  • and end with the string ]]>


An example of a CDATA section, in which “<greeting>” and “</greeting>” are recognized as character data, not markup:

<![CDATA[<greeting>Hello, world!</greeting>]]> 

Documentation / Reference

Powered by ComboStrap