--- In flexcoders@yahoogroups.com, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> You do not need to loop to delete a node.  Use an e4x expression to
> locae the node, then use the delete statement to delete it.  Two 
things
> complicate this.  
> 
>  
> 
> On is that it is not always obvious how to write the expession to 
locate
> the node.  I use variable and trace to make sure I am finding the
> correct nde:
> 
>   var xmlToDelete:XML = xml.(item == 'Chicken')[0];   //all e4x
> expressions retun XMLList, so the [0] is required to return XML
> 
>   trace(xmlToDelete.toXMLString()); //should return the chicken 
node.
> 
>  
> 
> The second issue is that you cannot use a reference to a node to 
delete.
> So you *cannot* do:
> 
>   delete xmlToDelete;
> 
> The above will produce an error.  So use the  var and trace
> toXMLString() technique to build the espression, but use it 
directly in
> the delete:
> 
>   delete xml.(item == 'Chicken')[0];
> 
>  
> 
> I do not think you can delete and XMLList directly, but must delete 
XML.
> The docs are not clear on this and I have not tested recently.

I had a similar situation last week, and the expression I used was 
similar to

delete xml.items.item.(text()=='Chicken');

http://flexdiary.blogspot.com/2008/03/comparing-xml-nodes-of-same-
name-with.html

HTH;

Amy

Reply via email to