There is no Object.appendChild(), or Object.insertChildBefore(), or
Object.insertChildAfter(), or Object.children(), or Object.parent(),
or....

 

If that is indeed the argument, then I think it is a "foolish
consistency".

 

But that is just my emotional opinion, I do not even pretend to think at
that level of design.  I'm a coder, in the end, I'll work within the
language.

 

Tracy

 

________________________________

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

 

I think their argument is that there is no Object.delete() either.  To
me, the whole point of E4X is to get at XML more like it was an object.

 

________________________________

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

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