I think the key in that is using the ordinal index into the XML list.

 

I know Adobe is following the ecma specifications, but someone needs to
slap those ecma guys for not providing an XML.delete() method.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Tracy Spratt
Sent: Tuesday, October 02, 2007 5:21 PM
To: [email protected]
Subject: RE: [flexcoders] How to filter out nodes from an XMLList?

 

I have used this function to delete the child nodes of a function.  I
think that you could replace the "children()" with any e4x expression:

  private function deleteChildren(xmlNode:XML):void

  {

    var xlChildren:XMLList = xmlNode.children();

    for (var i:int=xlChildren.length()-1;i>=0;i--)

    {

        delete xlChildren[i];                                 //so
remove all the children

    }   

  }//deleteChildren

 

Tracy

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of ambrice
Sent: Tuesday, October 02, 2007 4:08 PM
To: [email protected]
Subject: [flexcoders] How to filter out nodes from an XMLList?

 

I want to delete all nodes in an XML/XMLList that match a filter. 
Something like:

delete myxml..employee.(@name == "Bob");

However I get an error saying you can't use delete on an XMLList. I
tried:

for each (var node:XML in myxmllist) {
delete node;
}

But I get an error about not being able to delete a staticly assigned
variable or something like that. There also doesn't seem to be a
node.remove() method or anything handy like that. Actionscript's E4X
implementation seems to think that you would only want to add nodes to
an XML. Any ideas?

Thanks,
Aaron

 

Reply via email to