tags:

views:

11

answers:

1

I have an xml as a string in flex in the below format. I can have as many nested groups and test as possible. I need a way to find which are checked, how can I iterate through this?

<node label="All" checked="0">
   <node label="Group1" checked="0"> 
             <node label="Test1" checked="0" />
             <node label="Test2" checked="0" />
              <node label="Group1Inner" checked="0"> 
                  <node label="Test1Inner" checked="0" />
                  <node label="Test2Inner" checked="0" />
             </node>
              <node label="Group2Inner" checked="0"> 
                  <node label="Test1Inner" checked="0" />
                  <node label="Test2Inner" checked="0" />
             </node>
   </node>
</node>
+2  A: 

You can manage this by using E4X

var xx:XML = <node label="All" checked="0">
   <node label="Group1" checked="0"> 
             <node label="Test1" checked="0" />
             <node label="Test2" checked="0" />
              <node label="Group1Inner" checked="0"> 
                  <node label="Test1Inner" checked="0" />
                  <node label="Test2Inner" checked="0" />
             </node>
              <node label="Group2Inner" checked="0"> 
                  <node label="Test1Inner" checked="0" />
                  <node label="Test2Inner" checked="0" />
             </node>
   </node>
</node>;

trace(xx..node.(@checked==0))
kubarium