Ben,

Thanks for your help.  It works great!

I have another question that I'm not sure if you will be able to
answer or not.  If I have 3 levels of hierarchy in my XML and I want
to remove level 2 (but not its children - level 3) how would you go
about doing that?  Eliminate level 2 while promoting level 3.

<level1>
<level2>

<level3/>
<level3/>
<level3/>

</level2>
</level1> 

Transformed to...

<level1>

<level3/>
<level3/>
<level3/>

</level1>

--- In [email protected], "ben.clinkinbeard"
<[EMAIL PROTECTED]> wrote:
>
> Wow, I had no idea deleting a set of nodes would be this hard.
> Apparently this is how its done:
> 
> for each(var node:XML in myXML..remove)
> {
>       delete(myXML..remove[node.childIndex()]);
> }
> 
> HTH,
> Ben
> 
> 
> --- In [email protected], "phipzkillah" <pkrasko@> wrote:
> >
> > 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