Lasso Soft Inc. > Home

[ xml_element->getattribute ]


The [xml_element->getattribute] method returns the contents of the named attribute of the given xml_element.

Takes one parameter, the name of the attribute. Returns an empty string if the attribute does not exist for the particular xml_element.

  • Syntax
xml_element->getattribute( 'attribute_name' )
  • Beginner

Return the value of an attribute of an XML element

Use the [xml_element->getattribute] method.

This example shows haw to return the values of the day and weekday attributes of an xml_element called "vacation".


var(vacationDays = xml('<vacation day="23" weekday="Friday"><employee>Sean</employee></vacation>') )

'Day is '+$vacationDays->getattribute('day')+'\n'
'Weekday is '+$vacationDays->getattribute('weekday')


Day is 23
Weekday is Friday

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