delete xml.child.(@id=="b");


You might wanna try that first..

TypeError: Error #1119: Delete operator is not supported with operand of type XMLList.
"delete" works as long as the XMLList is not retrieved using an expression, which in this 
case it is: (@id == "b").

So the following works (and deletes all elements):

   var s:String = '<parent><child id="a" /><child id="b" /><child id="a" /><child id="b" 
/></parent>';
   var xml:XML = new XML(s);
   delete xml.child;

Bug or feature? Who knows..

regards,
Muzak

----- Original Message ----- From: "liutoday" <today...@hotmail.com>
To: <flashcoders@chattyfig.figleaf.com>
Sent: Monday, March 09, 2009 5:28 AM
Subject: RE: [Flashcoders] find and delete XML nodes





Date: Sun, 8 Mar 2009 23:38:17 -0400
From: j...@stranskydesign.com
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] find and delete XML nodes

I have some xml nodes where I need to evaluate their attributes and delete
them if they meet certain criteria. It's probably simple but its late and
brain fatigue is setting in.

Say I had this node

<parent>
  <child id="a" />
  <child id="b" />
  <child id="a" />
  <child id="b" />
</parent>

How would I find and delete any <child> who's id is "b" ?
--
--Joel Stransky
stranskydesign.com
_______________________________________________


delete xml.child.(@id=="b");


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to