Retrieves the attribute value of the node from an XML document in memory.
Syntax
INT XMLGetAttribute(INT hDoc, INT hNode, STRING sAttributeName)
hDoc
Handle of the XML document. Returned by XMLCreate or XMLOpen.
hNode
Handle of the node. Returned by XMLGetRoot, XMLGetChild, XMLGetParent or XMLNodeFind.
sAttributeName
Name of attribute.
Return Value
Value of specified node's attribute
Related Functions
XMLClose, XMLCreate, XMLGetAttributeCount, XMLGetAttributeName, 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 value of the node’s attribute "Language".
INT hDoc, hNode; STRING sValue; hDoc=XMLOpen("H:\Data\books.xml"); IF hDoc <> -1 THEN hNode = XMLNodeFind(hDoc,"/bookstore/book/"); IF hDoc <> -1 THEN sValue=XMLGetAttribute(hDoc,hNode,"Language"); End End
See Also
Published June 2018