How can I remove a selection of children from an xml tree.  

var myXML:XML =
<root>
   <cluster>
      <remove>
         <garbage/>
         <garbage/>
         <garbage>
            <garbage1/>
            <garbage2/>
            <garbage3/>
         </garbage>
      </remove>
      <remove>
         <garbage>
            <garbage1/>
            <garbage2/>
         </garbage>
         <garbage/>
      </remove>

      <keep>
         <info/>
         <info/>
         <info>
            <goodStuff/>
            <goodStuff/>
            <goodStuff>
               <good1/>
               <good2/>
            </goodStuff>
         </info>
      </keep>
   </cluster>
</root>

......................

Now I want to keep all the good stuff.

I want the final xml tree to look like this:
<root>
   <cluster>
      <keep>
         <info/>
         <info/>
         <info>
            <goodStuff/>
            <goodStuff/>
            <goodStuff>
               <good1/>
               <good2/>
            </goodStuff>
         </info>
      </keep>
   </cluster>
</root>

I tried doing this with no luck:

myXML = delete myXML..remove;

Any ideas why that doesn't work?



Reply via email to