JavaScript: E4XECMAScript for XML (E4X) is an extension of JavaScript that provides native JavaScript syntax for manipulating XML. XML in AltThe Alt Framework makes heavy use of XML for both SQueaL's SQL Schema and the Onion ML markup system. E4X's native JavaScript syntax was the logical approach for working with XML in the Alt Framework on the server side. E4X DocumentationAside from the highly technical ECMA specification, there are no official references on E4X. The best documentation I have found to date is this page. Only Firefox 1.5+ supports E4X natively in client-side JavaScript, so that any web page that needs to work in Internet Explorer cannot use E4X. Quick ReferenceThis reference is not intended to be official, it is simply my interpretation of various features in E4X. XML objectE4X defines XML as a core JavaScript object. It can be constructed by literal XML in your code: The literal XML syntax allows you to refer to JavaScript variables in XML blocks by using curly braces. E.g. xml = <foo name="bar"> <sbu> <bus/> </sbu> <boo/> With the above JavaScript, you can do the following:
... to name a few things. XMLList objectThis object acts like an array with one main difference: length is a method and not a property. That means to get the number of XML nodes in a XMLList object, you need to use E4X Web sitesRecommended ResourcesThese are the links I recommend reading to get a feel for E4X from several sources. rephrase E4X reference - A one-page straight-forward explanation and reference to E4X AJAX and scripting Web services with E4X - A tutorial from IBM's developerworks site. A good starting point for familiarizing yourself with E4X Jon Udell: Introduction to E4X - Another tutorial/introduction. This article looks at some of the filtering and search capabilities of E4X not covered in the IBM article. Adobe ActionScript 3 E4X API/overview - A full, readable reference to the E4X objects and their functionality. javascript.faqts - Not well organized, but packed with details of E4X and how to work with it. In FAQ format, it approaches documentation in question and answer format. Other ResourcesFor the sake of completeness, these are other sites I have found that discuss E4X, but are only worth reading if you are looking for more information Wikipedia: E4X - This site provides an overview, description, and background of E4X, along with a few links, mostly listed here. W3 Schools E4X Tutorial - This site also has a quick overview of E4X and a comparison to other approaches. It shows some sample code and how to manipulate XML objects, but does not go into detail. Standard ECMA-357 - The E4X Specification. This highly technical PDF is more geared toward implementing E4X than using it. |
|
page last updated: Thursday, February 14, 2008 |