Name: revXMLAddNode

Type: command

Syntax: revXMLAddNode <treeID>, <parentNode>, <nodeName>, <nodeContents>, [<location>]

Summary: Adds a <child node> to the specified parent <node> in an <XML tree>.

Introduced: 2.0

OS: mac,windows,linux,ios,android

Platforms: desktop,server,web,mobile

Security: disk

Example:
revXMLAddNode 9,"/","Balls",""

Example:
revXMLAddNode myTree,theNode,the short name of me,field "Contents"

Parameters:
treeID: The number returned by the revXMLCreateTree or revXMLCreateTreeFromFile function when you created the XML tree.
parentNode: The node whose child the node being created will be.
nodeName: The name of the new node.
nodeContents: The text to place in the new node.
location: An optional argument. If it is not present or if it is equal to "after", the node will be added as the last child of parentNode. If location is "before" then the node will be added as the first child of parentNode.

The result: If the <revXMLAddNode> <command> encounters an error, the <result> is set to an error message beginning with "xmlerr".

Description:
Use the <revXMLAddNode> <command> to add a <node> to an <XML tree>.

>*Important:*  The <revXMLAddNode> <command> is part of the <XML library>. To ensure that the <command> works in a <standalone application>, you must include this <Revolution custom library|custom library> when you create your <standalone application|standalone>. In the Inclusions section on the General screen of the <Standalone Application Settings> window, make sure "XML Library" is selected in the list of script libraries.

References: revXMLMoveNode (command), revXMLDeleteNode (command), revXMLAppend (command), result (function), node (glossary), Standalone Application Settings (glossary), standalone application (glossary), XML tree (glossary), command (glossary), child node (glossary), XML library (library), Revolution custom library (library)

Tags: text processing
