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
( <, >, and &) 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.