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

XMLGetRoot

Gets the root element of the specified XML document.

Syntax

INT XMLGetRoot(INT hDoc)

hDoc

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

Return Value

Handle of root element, or-1 on error.

Related Functions

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

Example

Following example creates an XML document from local file "H:\Data\books.xml", then gets the root element.

 

INT hDoc, hRoot;
hDoc=XMLOpen("H:\Data\books.xml");
If hDoc <> -1 THEN
	hRoot=XMLGetRoot(hDoc);
End		
	

See Also

XML Functions

Published June 2018