Say you have some xml like so..

<api>
  <classType name="containers">
     <class name="flowing">
         <property name="width" version="1.0">
           <paramenterType>String</paramenterType>
           <returnType>void</returnType>
         </property>
         <property name="height" version="2.0">
           <paramenterType>String</paramenterType>
           <returnType>void</returnType>
         </property>
         <method name="getWidth" version="1.0">
           <paramenterType>String</paramenterType>
           <returnType>void</returnType>
         </property>
     </class>
  </classType >
  <classType name="printing">
     <class name="screenPrint">
         <property name="length" version="1.0">
           <paramenterType>String</paramenterType>
           <returnType>void</returnType>
         </property>
         <property name="face" version="2.0">
           <paramenterType>String</paramenterType>
           <returnType>void</returnType>
         </property>
         <method name="getText" version="1.0">
           <paramenterType>String</paramenterType>
           <returnType>void</returnType>
         </property>
     </class>
  </classType >
</api>

If you apply the regular expression

var filter:XMLList = xmlData.classType..property.( /1.0/.test( 
@version ));


It would return 
         <property name="width" version="1.0">
           <paramenterType>String</paramenterType>
           <returnType>void</returnType>
         </property>

         <property name="length" version="1.0">
           <paramenterType>String</paramenterType>
           <returnType>void</returnType>
         </property>


My question is how to make it so the parents and grandparents of the 
result are still present?? Something like this as the result

<api>
  <classType name="containers">
     <class name="flowing">
         <property name="width" version="1.0">
           <paramenterType>String</paramenterType>
           <returnType>void</returnType>
         </property>
  </classType>
  <classType name="printing">
     <class name="screenPrint">
         <property name="length" version="1.0">
           <paramenterType>String</paramenterType>
           <returnType>void</returnType>
         </property>
  </classType>
</api>

Thanks
Dylan


Reply via email to