AddElement method: XmlNode class
Syntax
AddElement(TagName)
Description
Use the AddElement method to add an element to the XmlNode. The new element is appended to the list of child nodes.
To insert an element at a particular place in the list of nodes, use the InsertElement method instead.
A reference to the newly created element is returned.
Parameters
| Parameter | Description |
|---|---|
|
TagName |
Specify the tag for the new element that you are adding, as a string. |
Returns
A reference to the newly created element.
Example
For example:
Local XmlDoc &inXMLDoc;
Local XmlNode &childNode;
&inXMLDoc = CreateXmlDoc("<?xml version='1.0'?><myroot/>");
&childNode = &inXMLDoc.DocumentElement.AddElement("child");
The preceding PeopleCode program produces the following XML:
<?xml version="1.0"?>
<myroot>
<child/>
</myroot>