XmlGetItem returns a node from the nodelist. The nodes are identified by their index in the list beginning with 0 for the first. Use XmlGetCount to determine the number of nodes in the nodelist. You can iterate through the nodes in the nodelist by accessing the nodes from index 0 to XmlGetCount - 1.
If you want to access a specific child node, you can also call XmlGetChildByIndex to get a direct reference to a child node.
XmlAPI.bdh
XmlGetItem( in hNodeList : number, in nIndex : number ): number;
Parameter | Description |
---|---|
hNodeList | A valid node list |
nIndex | Index of the node that should be returned. Index for first element is 0. |
dcltrans transaction TMain var hDocument, hResult : number; hOrderItems, hItem : number; hCount, itemIx : number; sAttrValue : string; begin hDocument := XmlCreateDocumentFromFile("C:\\MyXMLDocuments\\Order.xml"); hOrderItems := XmlSelectNodes(hDocument, "//OrderItem"); hCount := XmlGetCount(hOrderItems); for itemIx := 0 to hCount - 1 do hItem := XmlGetItem(hOrderItems, itemIx); XmlGetAttributeByName(hItem, "price", sAttrValue); end; end TMain;