Archive for January, 2006

E4X

Tuesday, January 24th, 2006

I am sure that alot of you are familiar with parsing xml documents in ActionScript 2.0 and JavaScript, and though it is fun to do and most of us already have plenty of AS 2.0 parsing utility classes such as XMLSA, but in reality it is quite timely to some extent.

Welcome to E4X, quite simply ECMAScript for XML (E4X), and in my opinion this is the way that it should be done. I have written many classes that convert XML nodes into ActionScript objects, similar to how mxml is converted to native ActionScript objects at compiletime in Flex. This may be appropriate for certain applications but when it comes to just parsing a document E4X makes much more since. What E4X does is incredibly simple and logical. Since the xml document is contained inside an XML object you then have access to all of it’s properties, which are nothing more than the documents nodes, attributes, etc. ActionScript 3.0 will have support for this new standard which we can take advantage of without having to worry about the limitations of most browsers at the moment since none of the mainstream browsers are currently supporting E4X. Check out www.ecma-international.org to learn more.