Thanks, that works for me.

I think while searching for a solution I read that Mozilla's
javascript engine extends E4X to support "delete" with XMLList objects
which I think should be part of the spec if it's not.  The intuitive
thing to do would be to say "delete xmlNode.children();" and not have
to worry about looping.

Aaron

--- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> 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