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

XMLGetChild

Retrieves the child node for the specified parent node in XML document in memory.

Syntax

INT XMLGetChild(INT hDoc, INT hNode, INT iChild)

hDoc

Handle of the XML document the parent node belongs to. Returned by XMLCreate or XMLOpen.

hNode

Handle of the parent node. Returned by XMLGetRoot, XMLGetChild, XMLGetParent or XMLNodeFind.

iChild

The child index.

Return Value

Handle of child node, or -1 on error

Related Functions

XMLClose, XMLCreate, XMLGetAttribute, XMLGetAttributeCount, XMLGetAttributeName, XMLGetAttributeValue, XMLGetChildCount, XMLGetParent, XMLGetRoot, 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 node, then gets the first child node of the root node.

 

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

See Also

XML Functions

Published June 2018