简体   繁体   English

如何使用flex捕获xml中父节点下的所有子节点?

[英]How do I grab all children nodes under the parent node in xml using flex?

I have a parent node and I'm trying to get each child node under that parent and store it into an arraycollection? 我有一个父节点,并且我试图获取该父节点下的每个子节点并将其存储到arraycollection中? How could I go by doing this? 我该怎么做?

var coll:ArrayCollection = new ArrayCollection();

for each ( var child:XML in parent.children()) {
    coll.add(child);
}

parent.children() gives you all child nodes of parent as XMLList. parent.children()为您提供parent的所有子节点作为XMLList。 You can then add each child to the collection. 然后,您可以将每个孩子添加到集合中。

If you want to include only element nodes, you can use elements() instead of children(). 如果只想包含元素节点,则可以使用elements()代替children()。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在没有事件的情况下获取xml中的父节点? - How could I grab a parent node in xml without an event? 使用XML关联子节点和父节点的值 - Using XML to associate the values of children and parent nodes 根据属性对XML进行排序,以保留Python中每个父节点的所有子节点 - Sorting XML based on attributes retaining all children nodes for each parent node in Python 如何使用javascript访问特定节点下的xml节点? - How to access xml nodes under a specific node using javascript? 如何使用Powershell从xml文件中仅导入父节点而保留所有子节点? - How to import only parent node leaving all the child nodes from xml file using powershell? 如何在 Java、XML 文件中的特定父节点下显示具有特定 id 和标签名称的节点的值? - How can I show the values of Nodes with specific id and tag name and under specific parent node in Java, XML file? 在R中如何从公共父节点配对XML节点值? - In R how do I pair XML node values from common parent nodes? XML中的所有子节点都链接到父节点 - All Child Nodes in XML are linked to a Parent Node VBA在单个父节点下导入多个XML子级 - VBA Importing multiple XML children under a single parent node 如何使用Java从XML读取父节点的子节点 - How to read child nodes of a parent node from XML using java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM