Wednesday, June 13, 2007

E4X -- ECMAScript for XML

It is perhaps not critical to understand now, but those who want to take a look at what is perhaps ahead, should consider checking out E4X, or ECMAScript for XML. It has already been implemented in SpiderMonkey and Rhino, and has been standardized in ECMA-357 standard.

E4X places XML objects as first class JavaScript objects -- just like objects, arrays, functions and Regular Expressions (which I for one, need to admittedly get better with).

This is particularly attractive -- from page 11 of the E4X slides:

* Expandos make markup composition a snap!
* Just start appending extra property tiers:

var html = <html/@lt;
html.head.title = "My Page Title";
html.body.@bgcolor = "#e4e4e4";
html.body.form.@name = "myform";
html.body.form.@action = "someurl.jss";
html.body.form.@method = "post";
html.body.form.@onclick = "return somejs();";
html.body.form.input[0] = "";
html.body.form.input[0].@name = "test";

* Results in this XML:

<title>My Page Title</title>
<body bgcolor="#e4e4e4">
<form name="myform" action="someurl.jss"
method="post" onclick="return somejs();">
<input name="test"></input>

...the future is surely bright for open source, browser native, Ajax.


Andrew said...


Sorry to put this in here, I couldn't find an email address.

I was reading your blog and wanted to shoot you a quick note. I am a recruiter for XIF Communications ( and wanted to see if I could get your help on a search I'm doing. I'm looking for strong Flash/Actionscript/Flex Engineers with a strong OO programming background. We are looking for true developers/engineers, not designers.

We are open to speaking with any developer across the US. While XIF is located in Washington, DC, we would not require relocation. We just need the best. If you know anyone (or yourself) who could be a good fit, I'd love to speak with him or her.

XIF is a leading provider of Internet Consulting, Web Development, Interface Design and Enterprise Integration services. Just a few of the companies we have worked with include The National Geographic Channel, The NFL Players Association and Newsweek.

Let me know if you're interested in speaking at length.


Andrew Brown
301.287.8316 (direct)

we simplify the internet said...

hey nice post. do you know where i can find more useful info about E4X?

Cheers. Thanks.


we simplify internet

Mark Holton said...

Hey Chrissy,
Glad you liked. for E4X, there are lots of references, and it's not that popular yet, so no books that I know of. But Flex (adobe) embedded E4X, so you might check that out too. (Hopefully Google Gears will embed E4X too)