Lasso Soft Inc. > Home

[ xml_node->childNodes ]


The  [xml_node->childNodes] method returns an xml_nodeList of all of the immediate children of the named xml_node.

Note: the items of the resulting list are indexed starting at 0.

  • Syntax
  • Beginner

Get a list of the all the child nodes of an xml_node

This example uses the [xml->childNodes] method to drill down into the first child node of the XML node "month" to retrieve the node containing the last day of the month. Notice the indexing that is used in the [xml_nodeList->item] method to retrieve the desired xml_element.


var(aMonth = xml('<month>
        <date type="lastDay">31</date>
</month>') )

'The child nodes are: \n'+$aMonth->childNodes()+'\n\n'

var( theMonth = $aMonth->childNodes->item(0) )

'The Month is: \n'+$theMonth+'\n\n'

var( lastDay = $theMonth->childNodes->item(1) )

'The lastDay is '+$lastDay


The child nodes are: 
  <date type="lastDay">31</date>
</data>, <date>4</date>, <date>11</date>, <date>16</date>, <date>23</date>, <date>30</date>)

The Month is: 
  <date type="lastDay">31</date>

The lastDay is <date type="lastDay">31</date>

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