AddCDataSection method: XmlNode class

Syntax

AddCDataSection(Data)

Description

Use the AddCDataSection to add a CDATA section to an XmlNode.

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.

To insert a CDATA section at a particular place in the list of nodes, use the InsertCDataSection method instead.

A reference to the newly created CDATA section is returned.

Note:

You cannot use this method with a SoapDoc object.

Parameters

Parameter Description

Data

Specify the data to be included in the CDATA section as a string.

Returns

A reference to the newly created CDATA section.

Example

For example:

Local XmlDoc &inXMLDoc;
Local XmlNode &childNode;
Local XmlNode &cdataNode;

&inXMLDoc = CreateXmlDoc("<?xml version='1.0'?><myroot/>");
&childNode = &inXMLDoc.DocumentElement.AddElement("child");
&cdataNode = &childNode.AddCDataSection("testing...");

The preceding PeopleCode program produces the following:

<?xml version="1.0"?>
<myroot>
  <child>
    <![CDATA[testing...]]>
  </child>
</myroot>