在flex4中检查空XML、XMLList或XMLListCollection
如何检查XML、XMLListCollection或XMLList在flex4中是否没有元素或至少包含一个或多个元素?如何使用该方法 文件样本:在flex4中检查空XML、XMLList或XMLListCollection,xml,actionscript-3,apache-flex,flex4,Xml,Actionscript 3,Apache Flex,Flex4,如何检查XML、XMLListCollection或XMLList在flex4中是否没有元素或至少包含一个或多个元素?如何使用该方法 文件样本: var xml:XML = <order> <item>Rice</item> <item>Kung Pao Shrimp</item> </order>; trace(xml.item[0].con
var xml:XML =
<order>
<item>Rice</item>
<item>Kung Pao Shrimp</item>
</order>;
trace(xml.item[0].contains(<item>Rice</item>)); // true
trace(xml.item[1].contains(<item>Kung Pao Shrimp</item>)); // true
trace(xml.item[1].contains(<item>MSG</item>)); // false
您好@George Profenza,如果您至少知道xml包含一些元素,那就好了。在我的例子中,我对它包含的内容不感兴趣。我只想看看xml中是否包含一些元素。我不能使用.simple和.complex,因为elment至少可以有一个元素..但是用它们测试它的问题是..如果它是一个具有复杂结构的XML,那么条件变为false,这不是我的目标..我只需要知道它是否有一个元素..不在乎它是一个还是多个。。