XmlFindSubNode: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
==Description== | ==Description== | ||
This function | This function returns a named sub node of a particular XML node. | ||
==Syntax== | ==Syntax== | ||
[[xmlnode]] | [[xmlnode]] [[xmlFindSubNode]] ( parent, subnode, index ) | ||
===Required Arguments=== | ===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 | * '''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. | * '''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. | ||
Line 19: | Line 19: | ||
<options> | <options> | ||
</map> | </map> | ||
You could use the following code: | You could use the following code: | ||
maproot = [[getLoadedMapXMLRoot]] (); | maproot = [[getLoadedMapXMLRoot]] (); | ||
optionsnode = | optionsnode = [[xmlFindSubNode]] ( maproot, "options", 0 ); | ||
instructionsnode = | instructionsnode = [[xmlFindSubNode]] ( optionsnode, "instructions", 0 ); |
Revision as of 22:06, 24 March 2006
Description
This function returns a named sub node of a particular XML node.
Syntax
xmlnode xmlFindSubNode ( parent, subnode, 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.
Example
If you wanted to find the 'instructions' node in a map file, like this:
<map> <options> <instructions>Start at the begining and keep going until the end!</instructions> <options> </map>
You could use the following code:
maproot = getLoadedMapXMLRoot (); optionsnode = xmlFindSubNode ( maproot, "options", 0 ); instructionsnode = xmlFindSubNode ( optionsnode, "instructions", 0 );