- Documentation
- Shared functions
- xmlCreateChild
Function
xmlCreateChild
Adds a new child node with the given name at the end of the parent's children.
Syntax
xmlnode xmlCreateChild(xmlnode parentNode, string tagName)Arguments
parentNodexmlnode- The parent.
tagNamestring- The new tag name.
Returns
The new node, or false.
Example
local root = xmlCreateFile("players.xml", "players")
for _, player in ipairs(getElementsByType("player")) do
local node = xmlCreateChild(root, "player")
xmlNodeSetAttribute(node, "name", getPlayerName(player))
end
xmlSaveFile(root)
xmlUnloadFile(root)