- Documentation
- Shared functions
- xmlNodeSetAttribute
Function
xmlNodeSetAttribute
Sets a node attribute; numbers and other values are converted to text. nil or false removes the attribute.
Syntax
bool xmlNodeSetAttribute(xmlnode node, string name, string value)Arguments
nodexmlnode- The node.
namestring- Attribute name.
valuestring- The value, or
nil/falseto remove.
Returns
true on success.
Example
local root = xmlCreateFile("pos.xml", "pos")
local x, y, z = 2495, -1665, 13
xmlNodeSetAttribute(root, "x", x)
xmlNodeSetAttribute(root, "y", y)
xmlNodeSetAttribute(root, "z", z)
xmlSaveFile(root)
xmlUnloadFile(root)