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

XMLGetAttributeName

Gets name of specified XML Node’s attribute by using attribute index.

Syntax

STRING XMLGetAttributeName(INT hDoc, INT hNode, INT iAttribute)

hDoc

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

hNode

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

iAttribute

The attribute index.

Return Value

Name of specified node's attribute

Related Functions

XMLClose, XMLCreate, XMLGetAttribute, XMLGetAttributeCount, XMLGetAttributeValue, XMLGetChild, 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 selects the first node that matches XPath expression "/bookstore/book/", then gets name of the first attribute of the node.

 

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

See Also

XML Functions

Published June 2018