Returns the xml_element that the attribute belongs to.
xml_attr->ownerelement
This example loops through some XML and outputs a list of the attributes along with the xml elements they belong to.
Code
var( rhinos = xml('<rhinos>
<rhino class="coder">Jordon</rhino>
<rhino class="coder" type="lead">Jono</rhino>
<rhino class="writer">Rachel</rhino>
</rhinos>') )
local( c = $rhinos->childNodes )
loop(#c->length) => {
local( myNode = #c->item( loop_count - 1 ) )
local( atts = #myNode->attributes )
#atts->forEach => {^
'The attribute '+#1->name+'='+#1->value+' is in the element: '+#1->ownerelement+'\n'
^}
}
Result
The attribute class=coder is in the element: <rhino class="coder">Jordon</rhino> The attribute class=coder is in the element: <rhino class="coder" type="lead">Jono</rhino> The attribute type=lead is in the element: <rhino class="coder" type="lead">Jono</rhino> The attribute class=writer is in the element: <rhino class="writer">Rachel</rhino>
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 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Recent Comments