- 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}"/>
------解决方案--------------------
顶个,来接点分
希望早日解决