- Documentation
- Shared functions
- xmlNodeGetAttribute
Function
xmlNodeGetAttribute
Returns the value of a node attribute as text (convert numbers with tonumber).
Syntax
string xmlNodeGetAttribute(xmlnode node, string name)Arguments
nodexmlnode- The node.
namestring- Attribute name.
Returns
The value, or false when the attribute does not exist.
Example
local root = xmlLoadString('<car model="411" price="150000"/>')
local price = tonumber(xmlNodeGetAttribute(root, "price"))
xmlUnloadFile(root)