Kevin
Kevin

Reputation: 23634

Reading nodes in XML

> <root>
> 
> <module c_name="Executive Library">
> <node cd_title="Document One"
> cd_link="http://localhost/userMana/upload/feature.xml"/>
> </module> <module c_name="Rate Card"/>
> 
> <module c_name="Time Sheet"> <node
> cd_title="Document Two"
> cd_link="http://localhost/userMana/upload/epl-v10.html"/>
> </module> </root>

<mx:Tree dataProvider="{tree.module}" labelField="@c_name" borderThickness="0" x="28" y="56" width="350" height="414"></mx:Tree>

I am able to read the module name, but how can i read the cd_title, when the label field is different.

Upvotes: 0

Views: 214

Answers (1)

Chris Klepeis
Chris Klepeis

Reputation: 9973

var yourXML:XML = yourXMLData;

for each(var x:XML in yourXML.module)
{
    trace(x.node.@cd_title);
}

havent tested it but it should work. You may want to build an ArrayCollection formatted for the Tree then set that as the dataprovider

Check these links: accessing XML, using xml as dataprovider

Upvotes: 1

Related Questions