From Multi Theft Auto: Wiki

Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions.

Please use xmlFindChild instead.

This function returns a named sub node of a particular XML node.


xmlnode xmlFindSubNode ( xmlnode parent, string subnode, int index )

Required Arguments

  • parent: This is an xmlnode that you want to find the subnode under. This could be a node returned from another call to xmlFindSubNode.
  • subnode: This is the name of the subnode you wish to find.
  • index: This is the index of the node you wish to find. For example, to find the 5th subnode with a particular name, you would use 4 as the index value. To find the first occurence, use 0.


Returns an xmlnode object if the node was found, false otherwise.


Click to collapse [-]

If you wanted to find the 'instructions' node in a map file like this:

<map version="2.0">
            <instructions>Start at the begining and keep going until the end!</instructions>

You could use the following code:

maproot = getLoadedMapXMLRoot ()
optionsnode = xmlFindSubNode ( maproot, "options", 0 )
instructionsnode = xmlFindSubNode ( optionsnode, "instructions", 0 )

See Also