XML - Character data (CDATA)

> Markup Language (ML) > Extensible Markup Language (XML)

1 - About

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.

Advertising

3 - Escape

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

3.1 - Delimiter

CDATA sections begin with the string “ <![CDATA[ ” and end with the string “ ]]> ”:]

3.2 - Example

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

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

4 - Documentation / Reference