E4X
Encyclopedia
ECMAScript for XML is a programming language
extension that adds native XML
support to ECMAScript
(which includes ActionScript
, JavaScript
, and JScript
). The goal is to provide an alternative to DOM
interfaces that uses a simpler syntax for accessing XML documents. It also offers a new way of making XML visible. Before the release of E4X, XML was always accessed at an object level. E4X instead treats XML as a primitive (like characters, integers, and booleans). This implies faster access, better support, and acceptance as a building block (data structure) of a program.
E4X is standardized by Ecma International
in the ECMA-357 standard. The first edition was published in June 2004, the second edition in December 2005.
, used in OpenOffice.org
and several other projects, and SpiderMonkey, used in Firefox
, Thunderbird
, and other XUL-based applications. It is also supported by Tamarin
, the JavaScript engine used in the Flash
virtual machine. It is not supported by Nitro (Safari
), V8
(Google Chrome
), Opera, nor Internet Explorer
.http://code.google.com/p/chromium/issues/detail?id=30975
's Weblogic Workshop 7.0 released in February 2002. BEA's implementation was based on Rhino
and released before the ECMAScript E4X spec was completed in June 2004. John Schneider wrote an article on the XML extensions in BEA's Workshop at the time.
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....
extension that adds native XML
XML
Extensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....
support to ECMAScript
ECMAScript
ECMAScript is the scripting language standardized by Ecma International in the ECMA-262 specification and ISO/IEC 16262. The language is widely used for client-side scripting on the web, in the form of several well-known dialects such as JavaScript, JScript, and ActionScript.- History :JavaScript...
(which includes ActionScript
ActionScript
ActionScript is an object-oriented language originally developed by Macromedia Inc. . It is a dialect of ECMAScript , and is used primarily for the development of websites and software targeting the Adobe Flash Player platform, used on Web pages in the form of...
, JavaScript
JavaScript
JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....
, and JScript
JScript
JScript is a scripting language based on the ECMAScript standard that is used in Microsoft's Internet Explorer.JScript is implemented as a Windows Script engine. This means that it can be "plugged in" to any application that supports Windows Script, such as Internet Explorer, Active Server Pages,...
). The goal is to provide an alternative to DOM
Document Object Model
The Document Object Model is a cross-platform and language-independent convention for representing and interacting with objects in HTML, XHTML and XML documents. Aspects of the DOM may be addressed and manipulated within the syntax of the programming language in use...
interfaces that uses a simpler syntax for accessing XML documents. It also offers a new way of making XML visible. Before the release of E4X, XML was always accessed at an object level. E4X instead treats XML as a primitive (like characters, integers, and booleans). This implies faster access, better support, and acceptance as a building block (data structure) of a program.
E4X is standardized by Ecma International
Ecma International
Ecma International is an international, private non-profit standards organization for information and communication systems. It acquired its name in 1994, when the European Computer Manufacturers Association changed its name to reflect the organization's global reach and activities...
in the ECMA-357 standard. The first edition was published in June 2004, the second edition in December 2005.
Browser support
E4X is supported by Mozilla's RhinoRhino (JavaScript engine)
Rhino is an open source JavaScript engine. It is developed entirely in Java and managed by the Mozilla Foundation. The Foundation also provides another implementation of JavaScript engine written in C known as SpiderMonkey....
, used in OpenOffice.org
OpenOffice.org
OpenOffice.org, commonly known as OOo or OpenOffice, is an open-source application suite whose main components are for word processing, spreadsheets, presentations, graphics, and databases. OpenOffice is available for a number of different computer operating systems, is distributed as free software...
and several other projects, and SpiderMonkey, used in Firefox
Mozilla Firefox
Mozilla Firefox is a free and open source web browser descended from the Mozilla Application Suite and managed by Mozilla Corporation. , Firefox is the second most widely used browser, with approximately 25% of worldwide usage share of web browsers...
, Thunderbird
Mozilla Thunderbird
Mozilla Thunderbird is a free, open source, cross-platform e-mail and news client developed by the Mozilla Foundation. The project strategy is modeled after Mozilla Firefox, a project aimed at creating a web browser...
, and other XUL-based applications. It is also supported by Tamarin
Tamarin (JavaScript engine)
Tamarin is a free virtual machine with just-in-time compilation support intended to implement the fourth edition of the ECMAScript standard....
, the JavaScript engine used in the Flash
Adobe Flash
Adobe Flash is a multimedia platform used to add animation, video, and interactivity to web pages. Flash is frequently used for advertisements, games and flash animations for broadcast...
virtual machine. It is not supported by Nitro (Safari
Safari (web browser)
Safari is a web browser developed by Apple Inc. and included with the Mac OS X and iOS operating systems. First released as a public beta on January 7, 2003 on the company's Mac OS X operating system, it became Apple's default browser beginning with Mac OS X v10.3 "Panther". Safari is also the...
), V8
V8 (JavaScript engine)
The Google V8 JavaScript Engine is an open source JavaScript engine developed by Google and ships with the Google Chrome web browser. Lars Bak is the head programmer....
(Google Chrome
Google Chrome
Google Chrome is a web browser developed by Google that uses the WebKit layout engine. It was first released as a beta version for Microsoft Windows on September 2, 2008, and the public stable release was on December 11, 2008. The name is derived from the graphical user interface frame, or...
), Opera, nor Internet Explorer
Internet Explorer
Windows Internet Explorer is a series of graphical web browsers developed by Microsoft and included as part of the Microsoft Windows line of operating systems, starting in 1995. It was first released as part of the add-on package Plus! for Windows 95 that year...
.http://code.google.com/p/chromium/issues/detail?id=30975
Example
Implementations
The first implementation of E4X was designed by Terry Lucas and John Schneider and appeared in BEABEA Systems
BEA Systems, Inc. specialized in enterprise infrastructure software products known as "middleware", which connect software applications to databases and was acquired by Oracle Corporation on April 29, 2008.- History :...
's Weblogic Workshop 7.0 released in February 2002. BEA's implementation was based on Rhino
Rhino (JavaScript engine)
Rhino is an open source JavaScript engine. It is developed entirely in Java and managed by the Mozilla Foundation. The Foundation also provides another implementation of JavaScript engine written in C known as SpiderMonkey....
and released before the ECMAScript E4X spec was completed in June 2004. John Schneider wrote an article on the XML extensions in BEA's Workshop at the time.
- E4X is implemented in SpiderMonkey (GeckoGecko (layout engine)Gecko is a free and open source layout engine used in many applications developed by Mozilla Foundation and the Mozilla Corporation , as well as in many other open source software projects....
's JavaScript engine) since version 1.6.0 and in RhinoRhino (JavaScript engine)Rhino is an open source JavaScript engine. It is developed entirely in Java and managed by the Mozilla Foundation. The Foundation also provides another implementation of JavaScript engine written in C known as SpiderMonkey....
(Mozilla's other JavaScript engine written in Java instead of C) since version 1.6R1. - As Mozilla FirefoxMozilla FirefoxMozilla Firefox is a free and open source web browser descended from the Mozilla Application Suite and managed by Mozilla Corporation. , Firefox is the second most widely used browser, with approximately 25% of worldwide usage share of web browsers...
is based on Gecko, it can be used to run scripts using E4X. The specification is supported in the 1.5 release or later. - Adobe's ActionScriptActionScriptActionScript is an object-oriented language originally developed by Macromedia Inc. . It is a dialect of ECMAScript , and is used primarily for the development of websites and software targeting the Adobe Flash Player platform, used on Web pages in the form of...
3 scripting language fully supports E4X. Early previews of ActionScriptActionScriptActionScript is an object-oriented language originally developed by Macromedia Inc. . It is a dialect of ECMAScript , and is used primarily for the development of websites and software targeting the Adobe Flash Player platform, used on Web pages in the form of...
3 were first made available in late 2005. Adobe officially released the language with Flash PlayerAdobe Flash PlayerThe Adobe Flash Player is software for viewing multimedia, Rich Internet Applications and streaming video and audio, on a computer web browser or on supported mobile devices. Flash Player runs SWF files that can be created by the Adobe Flash authoring tool, by Adobe Flex or by a number of other...
9 on June 28, 2006. - E4X is available in Flash CS3, Adobe AIR and Adobe FlexAdobe FlexAdobe Flex is a software development kit released by Adobe Systems for the development and deployment of cross-platform rich Internet applications based on the Adobe Flash platform...
as they use ActionScript 3 as a scripting language. - E4X is also available in Adobe AcrobatAdobe AcrobatAdobe Acrobat is a family of application software developed by Adobe Systems to view, create, manipulate, print and manage files in Portable Document Format . All members of the family, except Adobe Reader , are commercial software, while the latter is available as freeware and can be downloaded...
and Adobe Reader versions 8.0 or higher. - E4X is also available in AptanaAptanaAptana, Inc. is a company making web application development tools for Web 2.0 and Ajax for use with programming languages such as JavaScript, Ruby, PHP and Python. Aptana's main products are Aptana Studio, Aptana Cloud and Aptana Jaxer...
's Jaxer Ajax application server which uses the Mozilla engine server-side. - Since the release of Alfresco Community Edition 2.9B, E4X is also available in this enterprise document management system.
External links
- ECMA-357 standard
- E4X at faqts.com
- Slides from 2005 E4X Presentation by Brendan Eich, Mozilla Chief Architect
- E4X at Mozilla Developer Center
- Introducing E4X at xml.com: compares E4X and json
- Processing XML with E4X at Mozilla Developer Center
- Tutorial from W3 Schools
- E4X: Beginner to Advanced at Yahoo Developer Network