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

如何使用flex获取xml中父节点下的所有子节点?,xml,apache-flex,flash,adobe,Xml,Apache Flex,Flash,Adobe,我有一个父节点,我正在尝试获取该父节点下的每个子节点,并将其存储到arraycollection?我怎么能这样做呢 var coll:ArrayCollection = new ArrayCollection(); for each ( var child:XML in parent.children()) { coll.add(child); } parent.children()将父节点的所有子节点作为XMLList提供给您。然后可以将每个子级添加到集合中 如果只想包含元素节点,

我有一个父节点,我正在尝试获取该父节点下的每个子节点,并将其存储到arraycollection?我怎么能这样做呢

var coll:ArrayCollection = new ArrayCollection();

for each ( var child:XML in parent.children()) {
    coll.add(child);
}
parent.children()将父节点的所有子节点作为XMLList提供给您。然后可以将每个子级添加到集合中


如果只想包含元素节点,可以使用elements()而不是children()。

谢谢!这正是我要找的。