Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在flex4中检查空XML、XMLList或XMLListCollection_Xml_Actionscript 3_Apache Flex_Flex4 - Fatal编程技术网

在flex4中检查空XML、XMLList或XMLListCollection

在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

如何检查XML、XMLListCollection或XMLList在flex4中是否没有元素或至少包含一个或多个元素?

如何使用该方法

文件样本:

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,这不是我的目标..我只需要知道它是否有一个元素..不在乎它是一个还是多个。。