2009-05-25 3 views
1

Ich versuche eine E4X-Abfrage auszuführen (auf dem folgenden XML), die alle "Accessor" -Knoten zurückgibt, die einen "metadata" -Knoten mit einem "name" -Attribut enthalten, das gleich "Required" ist .e4x Query basierend auf Unterattributen

Ich habe versucht ...

type.accessor.([email protected] == "Required") 

... aber das nur für Accessor Knoten arbeitet, die nur 1 Metadaten-Knoten haben.

Irgendwelche Hinweise?

<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> 

Antwort

4

Dies scheint zu funktionieren:

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

Es geht um die Klammer.

Versuchen Sie stattdessen (Reiniger)

var list:XMLList; 

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

dass alle Metadaten-Knoten zurück. Was ich brauche, sind alle Accessorknoten, die einen Metadatenknoten mit einem Namensattribut haben, das auf "Erforderlich" gesetzt ist. –