当前位置: 代码迷 >> Web开发 >> ,像下面的xml字符串,怎么在flex里显示出树形结构
  详细解决方案

,像下面的xml字符串,怎么在flex里显示出树形结构

热度:127   发布时间:2012-03-22 17:43:57.0
求助,像下面的xml字符串,如何在flex里显示出树形结构 - Web 开发 / 其他
XML code
<?xml version="1.0" encoding="gbk"?>
<RootNode>
<Node>
  <StructureID text="91"/>
  <StructureName  text="标题"/>
  <Node>
    <StructureID text="94"/>
    <StructureName  text="子标题"/>
  </Node>
</Node>
<Node>
  <StructureID text="97"/>
  <StructureName  text="致谢"/>
  <Node>
    <StructureID text="100"/>
    <StructureName  text="子标题"/>
  <Node>
    <StructureID text="101"/>
    <StructureName  text="子标题"/>
  <Node>
    <StructureID text="102"/>
    <StructureName  text="子标题"/>
  <Node>
    <StructureID text="103"/>
    <StructureName  text="子标题"/>
  </Node>
</Node>
</Node>
</Node>
</Node>
<Node>
  <StructureID text="98"/>
  <StructureName  text="文摘"/>
</Node>
<Node>
  <StructureID text="99"/>
  <StructureName  text="标题"/>
</Node>
</RootNode>


------解决方案--------------------
需要重新构造一下一个xml, 让每个node也有text属性
C# code

<mx:XMLList id="treeData" xmlns="">
    <RootNode>
    <Node StructureID="91" StructureName="标题">
      <Node StructureID="94" StructureName="子标题">
      </Node>
    </Node>
    <Node StructureID="97" StructureName="致谢">
      <Node StructureID="100" StructureName="子标题">
      <Node StructureID="101" StructureName="子标题">
      <Node StructureID="102" StructureName="子标题">
      <Node StructureID="103" StructureName="子标题">
      </Node>
    </Node>
    </Node>
    </Node>
    </Node>
    <Node StructureID="98" StructureName="文摘">
    </Node>
    <Node StructureID="99" StructureName="标题">
    </Node>
    </RootNode>
</mx:XMLList>
        
        <mx:Tree id="myTree" width="100%" height="100%" labelField="@StructureName"
                showRoot="false" dataProvider="{treeData}"/>

------解决方案--------------------
顶个,来接点分
希望早日解决