Cicode Programming Reference > Cicode Function Categories > XML Functions > XMLNodeFind

XMLNodeFind

Use this function to select the first XML node that matches the XPath expression.

Syntax

INT XMLNodeFind(INT hDoc, STRING sQuery)

hDoc

Handle of the XML document. Returned by XMLCreate or XMLOpen.

sQuery

XPath Expression

Return Value

Handle of the first XML node that matches the XPath expression, or BAD HANDLE on error.

Related Functions

XMLClose, XMLCreate, XMLGetAttribute, XMLGetAttributeCount, XMLGetAttributeName, XMLGetAttributeValue, XMLGetChild, XMLGetChildCount, XMLGetParent, XMLGetRoot, XMLNodeAddChild, XMLNodeGetName, XMLNodeGetValue, XMLNodeRemove, XMLNodeSetValue, XMLOpen, XMLSave, XMLSetAttribute

Example

Following example creates an XML document from local file "H:\Data\books.xml", then selects the first node that matches XPath expression "/bookstore/book/"

 
INT hDoc, hNode;
hDoc=XMLOpen("H:\data\books.xml");
IF hDoc <> -1 THEN
	hNode=XMLNodeFind(hDoc,"/bookstore/book/");
End
			

See Also

XML Functions

Published June 2018