XmlAppendChild Function

Action

Appends the node to a parent node as additional child node. If the child node has already had a parent node (is a node of an existing XML document), the node will be cloned and the cloned node will be appended to the passed parent node. After the call, hChildNode is the handle to the cloned node.

Include file

XmlAPI.bdh

Syntax

XmlAppendChild( in hParentNode : number,
                in hChildNode  : number ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hParentNode Handle to an XML node that will be the parent
hChildNode Handle to an XML node that will be appended to the parent node

Example

dcltrans
  transaction TMain
  var
  hDocument, hResult, hNewNode : number;
  begin
    hDocument := XmlCreateDocumentFromXml( "<root><child1 attr1='avalue1'>childvalue1</child1>"
                 "<child2 attr1= 'avalue2'>childvalue2</child2></root>");
    hNewNode := XmlCreateNode("child3");
    hResult  := XmlSelectSingleNode(hDocument, "/root");
    XmlAppendChild(hResult, hNewNode);
  end TMain;