I get a XML Response from a PHP Script which I access using [lastResult] property.
The problem is the follwing:
XML Structure:
<Main>
<Category1>
<Data Name="Data1">
<Item>
<Name>foo</Name>
<Info>bar</Info>
</Item>
<Item>
<Name>baz</Name>
<Info>FOO</Info>
</Item>
</Data>
<Data Name="Data2">
</Data>
</Category1>
<Category2>
</Category2>
</Main>
Now I specify the dataProvider for the DataGrid as
'lastResult.Category1.Data.(@Name == "Data1").Item'
This works fine enough & my data is correctly outputted. The only thing I need is that how can I access the @Name property of the <Data> tag.
I can output Name & Info of Items by specifying:
'Name'
'Info'
But I’m clueless how to specify the @Name attribute of the parent <Data> tag when I’ve selected Data.Item as the dataProvider.
From what I can make of it, I need to go up 1 level to the parent node, but I couldn’t find any reference so as how to go up one level while using [lastResult] dataProvider (all were using XMLListCollection::parent())
Any help is appreciated.
Regards,
Nisheeth Barthwal
lastResult.Category1.Data.(@Name == "Data1").Itemgives you XMLList of Items found in Data1. Each item is of type XML and you can callparent()function get parent node:Edit: to make it work inside DataGrid, you need to use
labelFunctionproperty of column. Set it to this: