Lasso Soft Inc. > Home

[ xml_nodeList->item ]

Method

The [xml_nodeList->item] method returns an element from an xml_nodeList object. The method requires one parameter which is the integer index of the element to be returned. 

Note: Unlike Lasso™ array objects, xml_nodeLists are 0 indexed. ie. to return the first element of the list use xml_nodeList->item( 0 ).

  • Syntax
xml_nodeList->item( index )
Examples
  • Beginner

Return an element from an xml_nodeList

Use the [xml_nodeList->item]  method.

This example retrieves the "date" node of the 3rd Monday from a list of dates stored in an xml document.

Note: whitespace is included in the xml snippet for readability only.

Code

var( aMonth = xml('<weekday day="Monday">
                       <date>4</date><date>11</date><date>16</date><date>23</date><date>30</date>
                  </weekday>') )

var( mondays = $aMonth->childNodes )

$mondays->item(2)

Result

<date>16</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