XMLFindNode

Top  Previous  Next

Prototype

 

intHandleNode:=XMLFindNode(intXMLHandle, intStartHandleNode, strPath)

 

Description

 

Returns the handle of a node specified in strPath .

 

Parameters

 

intXMLHandle: integer value corresponding to the XML handle

 

intStartHandleNode: node from which to begin the searching. (0 = root)

 

strPath: Path of the subnode to serach.

 

Returned value

 

intHandleNode:  integer value corresponding to the node handle

 

Notes

 

None

 

Example

 

XMLFileName:='C:\Recogniform\xml\new.xml';

 

//It opens the file

XMLIn:=XMLOpenDocument(XMLFilename);

if XMLIn<>0 then

begin

  //It finds root node

  Root:=XMLFindNode(XMLIn, 0,'d\p');

  //It counts all nodes

  RootChildCount:=XMLGetNodesCount(XMLIn,Root);

  for i:=0 to RootChildCount-1 do

  begin

    //It gets i-th node handle

    Child:=XMLGetNode(XMLIn, Root, i);

    //It gets node name

    NodeName:=XMLGetNodeName(XMLIn, Child);

    if NodeName='w' then

    begin

     //It gets node text

     NodeText:=XMLGetNodeText(XMLIn,Child);

     AttNodeText:=XMLGetNodeAttribute(XMLIn,Child,'ciclo_1');

     //It logs node values

     ApplicationLog('Node: '+NodeText+' has following attribute '+AttNodeText);

    end;                                  

  end;

end;