Lasso Soft Inc. > Home

[ xml_node->nodeType ]

Method

Returns the type of the given xml_node.

  • Syntax
xmlNode->nodeType
Examples
  • Beginner

Get the type of an xml_node

This example loops through an xml object and returns the node type of each of its child nodes.

Code

var( rhino = xml('<rhino>
     <name>Sean</name>
     <title>Grand Poobah</title>
     <location>Canada</location>
     <hairColour>Variable</hairColour>
</rhino>') )

loop($rhino->childNodes->length) => {^
      local( myNode = $rhino->childNodes->item( loop_count - 1 ) )
      'Node '+loop_count+' is '+#myNode->nodeType+'\n'
^}

Result

Node 1 is TEXT_NODE
Node 2 is ELEMENT_NODE
Node 3 is TEXT_NODE
Node 4 is ELEMENT_NODE
Node 5 is TEXT_NODE
Node 6 is ELEMENT_NODE
Node 7 is TEXT_NODE
Node 8 is ELEMENT_NODE
Node 9 is TEXT_NODE

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