The [xml_node->parentNode] method is used to return the complete parent node of a given node.
xml_node->parentNode
This example uses the [xml_node->parentNode] method to return the complete parent node of the individual xml elements with the tag name "name"
Code
var ( rhinos = xml('<rhinos>
<rhino>
<id>1</id>
<info>
<name>Sean</name>
<title>Fearless Leader</title>
</info>
</rhino> <rhino>
<id>33</id>
<info>
<name>Jordon</name>
<title>Programmer</title>
</info>
</rhino>
<rhino>
<id>26</id>
<info>
<name>Rachel</name>
<title>Manger</title>
</info>
</rhino>
</rhinos>') )
with i in $rhinos->getelementsbytagname('name')
do => {^
'The parent node of '+#i+' is: \n'+#i->parentNode+'\n\n'
^}
Result
The parent node of <name>Sean</name> is: <info> <name>Sean</name> <title>Fearless Leader</title> </info> The parent node of <name>Jordon</name> is: <info> <name>Jordon</name> <title>Programmer</title> </info> The parent node of <name>Rachel</name> is: <info> <name>Rachel</name> <title>Manger</title> </info>
Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Recent Comments