XmlGetCount Function

Action

XmlGetCount takes a nodelist handle and returns the number of nodes that are stored in this list. A nodelist will be returned by XmlGetChildNodes and XmlSelectNodes. To access a node in the nodelist call XmlGetItem.

Include file

XmlAPI.bdh

Syntax

XmlGetCount( in hNodeList : number ): number;

Return value

  • number of nodes

Parameter Description
hNodeList A valid node list handle

Example

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;