XmlGetChildNodes Function


XmlGetChildNodes returns a handle to a list of nodes (nodelist) that contains all child handles of the passed node/document handle. To access a node in the nodelist you have to use XmlGetItem. To determine the number of nodes in the nodelist, use XmlGetCount. If you call this method on an element node with a text value the function will return 1 because the text value itself is a child node of type text.

If you want to access a specific child node, you can also call XmlGetChildByIndex to get a direct reference to a child node.

Include file



XmlGetChildNodes( in hDocNode : number ): number;

Return value

  • nodelist handle if successful

  • 0 if failed

Parameter Description
hDocNode Handle to an XML node/document If the handle is a document handle, the root elements will be returned. Normally there is only one root element - except if there are processing instructions.


  transaction TMain
    hDocument, hRoot, hRootChildren: number;
    hDocument := XmlCreateDocumentFromXml( "<root><child1 attr1='avalue1'>childvalue1</child1>"
                  "<child2 attr1= 'avalue2'>childvalue2</child2></root>");
    hRoot := XmlSelectSingleNode(hDocument, "/root");  
    hRootChildren := XmlGetChildNodes(hRoot);
  end TMain;