2009-07-17 144 views
0
> <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> 

我能够读取模块名称,但是当标签字段不同时,如何读取cd_title。以XML读取节点

回答

1
var yourXML:XML = yourXMLData; 

for each(var x:XML in yourXML.module) 
{ 
    trace([email protected]_title); 
} 

没有测试过它,但它应该工作。你可能想建立格式化的树,然后设置为dataProvider中

检查这些链接的ArrayCollection:accessing XMLusing xml as dataprovider