- Documentation
- Shared functions
- xmlFindChild
Function
xmlFindChild
Finds a child with the given tag name. index picks which one (from 0) among children with that name.
Syntax
xmlnode xmlFindChild(xmlnode parent, string tagName [, int index = 0])Arguments
parentxmlnode- The parent.
tagNamestring- Tag name.
indexint, optional = 0- Number from 0 among children with that name.
Returns
The node, or false when there is none.
Example
local root = xmlLoadString("<cfg><color r='255' g='0' b='0'/></cfg>")
local color = xmlFindChild(root, "color", 0)
outputDebugString(xmlNodeGetAttribute(color, "r"))
xmlUnloadFile(root)