Make a copy().

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Daniel Freiman
Sent: Monday, January 28, 2008 11:48 AM
To: flexcoders
Subject: [flexcoders] Deleting Item from XMLList

 

I create an XMLList by concatenation.  When I try to delete an item from
the XMLList, it removes the item from the XMLList, and from the item's
original parent node (example below).

Is there any easy way to delete a single node from an XMLList without
destroying other references to that node?  Is this the intended behavior
of the delete operator?

- Dan Freiman


var xml:XML = "<root><value1/><value2/><value3/></root>"
var partialChildList:XMLList = new XMLList();
partialChildList += xml.value1[0];
partialChildList += xml.value2[0];

delete partialChildList[0];

// actual results
trace(xml); // "<root><value2/><value3></root>" // value1 is missing
trace(partialChildList); // <value2/>

// desired results:
trace(xml); // "<root><value1/><value2/><value3></root>" // unaltered
trace(partialChildList); // <value2/>

 

Reply via email to