基于子属性E4X查询

我试图执行一个E4X查询(下面的XML),将返回包含一个“元数据”节点与“name”属性等于“要求”所有“访问”节点。

我试过了...

type.accessor.(metadata.@name == "Required")

...但是,这仅适用于在只有1元数据节点访问节点。

任何线索?

<type name="org.springextensions.actionscript.ioc.testclasses::PersonRequiredName" base="org.springextensions.actionscript.ioc.testclasses::Person" isDynamic="false" isFinal="false" isStatic="false"> <metadata name="__go_to_definition_help"> <arg key="file" value="C:\workspace\spring-actionscript\core\src\test\actionscript\org\springextensions\actionscript\ioc\testclasses\PersonRequiredName.as"/> <arg key="pos" value="935"/> </metadata> <extendsClass type="org.springextensions.actionscript.ioc.testclasses::Person"/> <extendsClass type="Object"/> <constructor> <parameter index="1" type="String" optional="true"/> <parameter index="2" type="int" optional="true"/> <parameter index="3" type="Boolean" optional="true"/> </constructor> <accessor name="name" access="readwrite" type="String" declaredBy="org.springextensions.actionscript.ioc.testclasses::PersonRequiredName"> <metadata name="Required"/> <metadata name="__go_to_definition_help"> <arg key="file" value="C:\workspace\spring-actionscript\core\src\test\actionscript\org\springextensions\actionscript\ioc\testclasses\PersonRequiredName.as"/> <arg key="pos" value="1163"/> </metadata> <metadata name="__go_to_definition_help"> <arg key="file" value="C:\workspace\spring-actionscript\core\src\test\actionscript\org\springextensions\actionscript\ioc\testclasses\PersonRequiredName.as"/> <arg key="pos" value="1249"/> </metadata> </accessor> <variable name="age" type="int"> <metadata name="__go_to_definition_help"> <arg key="file" value="C:\workspace\spring-actionscript\core\src\test\actionscript\org\springextensions\actionscript\ioc\testclasses\Person.as"/> <arg key="pos" value="1070"/> </metadata> </variable> <accessor name="siblings" access="readonly" type="Array" declaredBy="org.springextensions.actionscript.ioc.testclasses::Person"> <metadata name="__go_to_definition_help"> <arg key="file" value="C:\workspace\spring-actionscript\core\src\test\actionscript\org\springextensions\actionscript\ioc\testclasses\Person.as"/> <arg key="pos" value="3724"/> </metadata> </accessor> <method name="addFriend" declaredBy="org.springextensions.actionscript.ioc.testclasses::Person" returnType="void"> <parameter index="1" type="org.springextensions.actionscript.ioc.testclasses::Person" optional="false"/> <metadata name="__go_to_definition_help"> <arg key="file" value="C:\workspace\spring-actionscript\core\src\test\actionscript\org\springextensions\actionscript\ioc\testclasses\Person.as"/> <arg key="pos" value="2424"/> </metadata> </method> <method name="toString" declaredBy="org.springextensions.actionscript.ioc.testclasses::Person" returnType="String"> <metadata name="__go_to_definition_help"> <arg key="file" value="C:\workspace\spring-actionscript\core\src\test\actionscript\org\springextensions\actionscript\ioc\testclasses\Person.as"/> <arg key="pos" value="3181"/> </metadata> </method> <method name="helloWorld" declaredBy="org.springextensions.actionscript.ioc.testclasses::Person" returnType="String"> <metadata name="__go_to_definition_help"> <arg key="file" value="C:\workspace\spring-actionscript\core\src\test\actionscript\org\springextensions\actionscript\ioc\testclasses\Person.as"/> <arg key="pos" value="2159"/> </metadata> </method> <method name="equals" declaredBy="org.springextensions.actionscript.ioc.testclasses::Person" returnType="Boolean"> <parameter index="1" type="org.springextensions.actionscript.ioc.testclasses::Person" optional="false"/> <metadata name="__go_to_definition_help"> <arg key="file" value="C:\workspace\spring-actionscript\core\src\test\actionscript\org\springextensions\actionscript\ioc\testclasses\Person.as"/> <arg key="pos" value="1932"/> </metadata> </method> <method name="hasSibling" declaredBy="org.springextensions.actionscript.ioc.testclasses::Person" returnType="Boolean"> <parameter index="1" type="org.springextensions.actionscript.ioc.testclasses::Person" optional="false"/> <metadata name="__go_to_definition_help"> <arg key="file" value="C:\workspace\spring-actionscript\core\src\test\actionscript\org\springextensions\actionscript\ioc\testclasses\Person.as"/> <arg key="pos" value="2789"/> </metadata> </method> <accessor name="writeObject" access="writeonly" type="Object" declaredBy="org.springextensions.actionscript.ioc.testclasses::Person"> <metadata name="__go_to_definition_help"> <arg key="file" value="C:\workspace\spring-actionscript\core\src\test\actionscript\org\springextensions\actionscript\ioc\testclasses\Person.as"/> <arg key="pos" value="3950"/> </metadata> </accessor> <variable name="colleague" type="org.springextensions.actionscript.ioc.testclasses::Person"> <metadata name="__go_to_definition_help"> <arg key="file" value="C:\workspace\spring-actionscript\core\src\test\actionscript\org\springextensions\actionscript\ioc\testclasses\Person.as"/> <arg key="pos" value="1132"/> </metadata> </variable> <variable name="anArray" type="Array"> <metadata name="__go_to_definition_help"> <arg key="file" value="C:\workspace\spring-actionscript\core\src\test\actionscript\org\springextensions\actionscript\ioc\testclasses\Person.as"/> <arg key="pos" value="1166"/> </metadata> </variable> <method name="addSibling" declaredBy="org.springextensions.actionscript.ioc.testclasses::Person" returnType="void"> <parameter index="1" type="org.springextensions.actionscript.ioc.testclasses::Person" optional="false"/> <metadata name="__go_to_definition_help"> <arg key="file" value="C:\workspace\spring-actionscript\core\src\test\actionscript\org\springextensions\actionscript\ioc\testclasses\Person.as"/> <arg key="pos" value="2605"/> </metadata> </method> <variable name="anObject" type="Object"> <metadata name="__go_to_definition_help"> <arg key="file" value="C:\workspace\spring-actionscript\core\src\test\actionscript\org\springextensions\actionscript\ioc\testclasses\Person.as"/> <arg key="pos" value="1197"/> </metadata> </variable> <accessor name="friends" access="readwrite" type="Array" declaredBy="org.springextensions.actionscript.ioc.testclasses::Person"> <metadata name="__go_to_definition_help"> <arg key="file" value="C:\workspace\spring-actionscript\core\src\test\actionscript\org\springextensions\actionscript\ioc\testclasses\Person.as"/> <arg key="pos" value="3583"/> </metadata> <metadata name="__go_to_definition_help"> <arg key="file" value="C:\workspace\spring-actionscript\core\src\test\actionscript\org\springextensions\actionscript\ioc\testclasses\Person.as"/> <arg key="pos" value="3645"/> </metadata> </accessor> <accessor name="isMarried" access="readwrite" type="Boolean" declaredBy="org.springextensions.actionscript.ioc.testclasses::Person"> <metadata name="__go_to_definition_help"> <arg key="file" value="C:\workspace\spring-actionscript\core\src\test\actionscript\org\springextensions\actionscript\ioc\testclasses\Person.as"/> <arg key="pos" value="3434"/> </metadata> <metadata name="__go_to_definition_help"> <arg key="file" value="C:\workspace\spring-actionscript\core\src\test\actionscript\org\springextensions\actionscript\ioc\testclasses\Person.as"/> <arg key="pos" value="3502"/> </metadata> </accessor> </type>

--------------解决方案-------------

这似乎工作:

type.accessor.(hasOwnProperty("metadata") && metadata.attribute("name").contains("Required"))

这是所有关于括号。

试试这个,而不是(清洁剂)

var list:XMLList;

xmlList = type.accessor.metadata.(@name == "Required");

分类:XML 时间:2015-03-16 人气:7
本文关键词: 弯曲,动作3,XML,E4X
分享到:

相关文章

Copyright (C) 55228885.com, All Rights Reserved.

55228885 版权所有 京ICP备15002868号

processed in 0.445 (s). 10 q(s)