Lasso Soft Inc. > Home

[ xml_node->extractone ]

Method

The xml_node->extractone] method is used to return the first of a set of child elements with the given tag name.

This method has one required parameter, the tag name to extract. If the requested tag is present [xml_node->extractone] returns the entire xml_element, if not it returns void.

  • Syntax
xml_node->extractone( 'child_tag_name' )
Examples
  • Beginner

To retrieve the first child element with a specified tag name

This example uses the [xml_node->extractone] method to retrieve the first "date" element from the "month" node. 

Code

var(aMonth = xml('<month>
    <data>
        <name>March</name>
        <date type="lastDay">31</date>
    </data>
    <date>4</date>
    <date>11</date>
    <date>16</date>
    <date>23</date>
    <date>30</date>
</month>') )

$aMonth->extractone('date')

Result

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