Saturday, December 14, 2024

A Brief Introduction to E4X

Share

I find myself longing for the old days, when I could design a web site in 5 minutes on a Sunday and then go play golf for the rest of the afternoon, and still collect a full week of salary for services rendered.

That was back in 1996, when the internet was still new. Websites were created exclusively with HTML. The client would email me the content for their website, which I would upload to FrontPage, then insert some tags and a template for formatting and layout, add some graphics, and that was it.

Nowadays, I find myself working up to 10 hours per day designing web sites. I have to use so many different programming languages and specifications when creating a site that it makes me dizzy. I can barely type this article because my brain literally hurts from all the different programming languages I have swirling around in my head.

You might be wondering why my job has become so complicated in recent years. Well, it started with the wireless revolution, which made a mess out of cyberspace. Now, every wireless gadget is equipped with access to the internet and email. Cell phones, palm tops, laptops, even computer screens in automobiles have web browsers. These gadgets have platforms and web browsers that are very different from what is installed on an ordinary desktop PC. These new web browsers are not compatible with many elements of the HTML programming language. As a result, websites created purely with HTML are often invisible or inaccessible to the wireless internet user.

New languages and specifications such as XHTML, XSL, and XML were created to conform to these new web browsers. XML was probably the most important innovation of them all. XML enabled web designers to define data without telling the browser how to display the data, unlike HTML, which both defines the data and tells the browser how to display it. XML data can be viewed on any platform or browser because it is a simple text file with no predefined tags, allowing the programmer to define data any number of ways. XHTML and XSL were created to convert XML files into actual web pages that had style and structure and could be viewed across all platforms and browsers.

Now that you understand how and why programming has changed, you are ready for a brief introduction to the main topic of this article, E4X. E4X adds direct support for XML to JavaScript. An XML object declared with E4X is written like this:

var x = new XML()

Using this method, it is much easier to parse an XML document than it would be using JavaScript. Without it, you would have to use different XML components and libraries for each browser, because each browser is compatible with different versions of the language. Also, E4X is advantageous to use because it does not require very much code.

However, none of the mainstream browsers currently support E4X. A beta-version of Mozilla is compatible with it, but not the actual version. Firefox 1.1 works with E4X, but Internet Explorer, the most popular and widely used browser, does not work with it. Instead, Internet Explorer utilizes various programming components of a programming specification called AJAX, which uses a variety of languages, including JavaScript, XML, CSS, and several others.

If you create web sites for a living, you should probably take some time to familiarize yourself with E4X. Even though it is not actively used right now, it likely will be in the near future. For now, learning AJAX is probably more important because of the dominance of Internet Explorer as the web browser of choice, but that could change. If you have never studied E4X but are already familiar with XML, you can probably learn it through simple online tutorials because the syntax is not too complicated. If you have never studied XML, XHTML, XSL, or AJAX, then you need to enroll in some courses at a local computer programming institute immediately. Not knowing how to use these new languages could mean that your web sites will be invisible to wireless internet users.

Tag:

Add to Del.icio.us | Digg | Yahoo! My Web | Furl

Bookmark Murdok:

Jim Pretin is the owner of http://www.forms4free.com, a service that helps programmers make email forms.

Table of contents

Read more

Local News