AddText method: XmlNode class
Syntax
AddText(Data)
Description
Use the AddText method to add a text node to an XmlNode.
Note:
A text node is not the same as a text declaration. The text declaration is added automatically with the CreateXmlDoc function. A text node just contains text within an XmlDoc.
To insert a text node at a particular place, use the InsertText method instead.
A reference to the newly created text node is returned.
Parameters
| Parameter | Description |
|---|---|
|
Data |
Specify the data to be used as the text node, as a string. |
Returns
A reference to the newly created text node.
Example
For example:
Local XmlDoc &inXMLDoc;
Local XmlNode &childNode;
Local XmlNode &textNode;
&inXMLDoc = CreateXmlDoc("<?xml version='1.0'?><myroot/>");
&childNode = &inXMLDoc.DocumentElement.AddElement("child");
&textNode = &childNode.AddText("This is text");
The preceding PeopleCode program produces the following XML:
<?xml version="1.0"?>
<myroot>
<child>This is text</child>
</myroot>
Related Topics