Stylus Studio XML Editor

Table of contents

Appendices

2.7 CDATA Sections

CDATA Sections

CDATA sections MAY occur anywhere character data may occur; they are used to escape blocks of text containing characters which would otherwise be recognized as markup. CDATA sections begin with the string "<![CDATA[" and end with the string "]]>":

CDATA Sections
2.7    CDSect   ::=   CDStart CData CDEnd
2.7    CDStart   ::=   '<![CDATA['
2.7    CData   ::=   (Char* - (Char* ']]>' Char*))
2.7    CDEnd   ::=   ']]>'

Within a CDATA section, only the CDEnd string is recognized as markup, so that left angle brackets and ampersands may occur in their literal form; they need not (and cannot) be escaped using "&lt;" and "&amp;". CDATA sections cannot nest.

An example of a CDATA section, in which "<greeting>" and "</greeting>" are recognized as Character Data, not Markup:

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