Title: is "delete" really the best/only way to remove a node in e4x?

The E4X standard allows the addition of APIs in certain circumstances, but not this one. The standard explicitly prohibits the addition of methods to the XML or XMLList prototype objects, which are where the other methods like appendchild(), etc. live. One could argue that we could add a removeChild() method, but only to the AS3 namespace, but I don’t know if we would want to go down that road.

 

I asked someone who worked on the E4X specification about the rationale for the lack of a removeChild() method, and not surprisingly he didn’t remember (it was a couple years ago and that’s a pretty esoteric issue). My guess is that the committee felt that delete was adequate and there was no need to add an extra method that did the same thing. Moreover, as Gordon mentioned below, the current implementation is consistent with the existing functionality of the delete operator, and one of the goals of the E4X spec was to use as much of the core language as possible to manipulate XML objects.

 

Apologies that our docs didn’t mention the delete operator in the XML class. In response to this thread, we’ve added links to the delete operator to the “See Also” sections of the four methods mentioned below.

 

Thanks for bringing this up,

 

Francis

 


From: [email protected] [mailto:[email protected]] On Behalf Of Gordon Smith
Sent: Thursday, May 25, 2006 2:16 PM
To: [email protected]
Subject: RE: [flexcoders] is "delete" really the best/only way to remove a node in e4x?

 

It may not be a Flash decision either since the API of the XML class is specified by the E4X standard. It would depend on whether that standard allows an implementor to add additional APIs or not.

 

- Gordon

 


From: [email protected] [mailto:[email protected]] On Behalf Of Peter Farland
Sent: Thursday, May 25, 2006 6:31 AM
To: [email protected]
Subject: RE: [flexcoders] is "delete" really the best/only way to remove a node in e4x?

 

For native Flash Player APIs, I'd log a bug against the player... this isn't really a Flex decision.

 


From: [email protected] [mailto:[email protected]] On Behalf Of Tracy Spratt
Sent: Wednesday, May 24, 2006 9:29 PM
To: [email protected]
Subject: RE: [flexcoders] is "delete" really the best/only way to remove a node in e4x?

I am not really fussing very hard, it is just that we have:

 

XML.appendChild()

XML.insertChildAfter()

XML.insertChildBefore()

XML.prependChild()

 

but no XML.removeChild?

 

delete is a completely different style syntax.

 

Tracy

 


From: [email protected] [mailto:[email protected]] On Behalf Of Gordon Smith
Sent: Wednesday, May 24, 2006 9:02 PM
To: [email protected]
Subject: RE: [flexcoders] is "delete" really the best/only way to remove a node in e4x?

 

I don't know whether it is the best or only way, but it seems consistent with the use of the 'delete' operator to remove a dynamic property of an Object.

 

- Gordon

 


From: [email protected] [mailto:[email protected]] On Behalf Of Tracy Spratt
Sent: Wednesday, May 24, 2006 4:48 PM
To: [email protected]
Subject: [flexcoders] is "delete" really the best/only way to remove a node in e4x?

 

If this is the final API, I can deal with it, it is just inconsistent and undocumented, and a bit of a shock when the rest of the api is so clean and logical.

I admit I have not read the e4x specification.

Tracy

 





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to