XML.CDataSection

CData sections in the XML message are represented by a syntax element with field type XML.CdataSection.

The content of the CDataSection element is the value of the CDataSection element without the <![CDATA[ that marks its beginning, and the ]]> that marks its end.

For example, the following CData section:
<![CDATA[<greeting>Hello, world!</greeting>]]>
is represented by a CDataSection element with a string value of:
"<greeting>Hello, world!</greeting>"
Unlike Content, occurrences of <,>, &, ", and ' are not translated to their XML character entities ( &lt;, &gt;, and &amp;) when the CDataSection is produced.

When to use XML.CDataSection

A CData section is often used to embed one XML message within another. By using a CData section, you ensure that the XML reserved characters ( <, >, and & ) are not replaced with XML character entities.

XML.AsisElementContent also allows the production of unmodified character data, but XML.CDataSection is typically a better choice because it protects the outer message from errors in the embedded message.

Parsing the contents of a CDataSection

A common requirement is to parse the contents of a CData section to create a message tree, which you can achieve by using the ESQL statement CREATE with the PARSE clause; see XMLNSC: Working with XML messages and bit streams.