Lasso Soft Inc. > Home

[ xml_node->parentNode ]

Method

The [xml_node->parentNode] method is used to return the complete parent node of a given node. 

  • Syntax
xml_node->parentNode
Examples
  • Beginner

To retrieve the parent node of an xml_node

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>

Recent Comments

No Comments found

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. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft