Thanks Steve - have it working.  Yep, I love E4X too - still learning
all the intricacies like this, so this is another notch in my belt.

(however for anyone listening and for the archives, your code does the
opposite of what I want. It removes all nodes WITH children.  I want to
remove any nodes that DON'T have children.  Changing that one line to
look for children length greater than 0 does the trick: var list:XMLList
= xml..module.(children().length() > 0); )

Thanks for your help,


Jason Merrill 

Bank of  America   Global Learning 
Shared Services Solutions Development 

Monthly meetings on the Adobe Flash platform for rich media experiences
- join the Bank of America Flash Platform Community 





-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Steven
Sacks
Sent: Tuesday, June 09, 2009 12:25 PM
To: Flash Coders List
Subject: Re: [Flashcoders] XML find and delete nodes

Filter the XML using E4X and then make a new XML from that filtered  
result.

var xml:XML = <xml>
        <modules>
                <module title="apple"/>
                <module title="orange">
                        <node/>
                </module>
                <module title="banana">
                        <node/>
                </module>
                <module title="plum"/>  
                <module title="pear"/>
                <module title="pineapple">
                        <node/>
                </module>
        </modules>
</xml>;
//
var list:XMLList = xml..module.(children().length() == 0);
var newXML:XML = <xml/>;
xml.setChildren(list);
trace(xml);
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to