ECMAScript for XML (E4X) was an extension to
ECMAScript
ECMAScript (; ES) is a standard for scripting languages, including JavaScript, JScript, and ActionScript. It is best known as a JavaScript standard intended to ensure the interoperability of web pages across different web browsers. It is stan ...
(which includes
ActionScript
ActionScript is an object-oriented programming language originally developed by Macromedia Inc. (later acquired by Adobe). It is influenced by HyperTalk, the scripting language for HyperCard. It is now an implementation of ECMAScript (mean ...
,
JavaScript
JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior.
Web browsers have ...
, and
JScript
JScript is Microsoft's legacy dialect of the ECMAScript standard that is used in Microsoft's Internet Explorer web browser and HTML Applications, and as a standalone Windows scripting language.
JScript is implemented as an Active Scripting eng ...
) to add native support for
XML
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing data. It defines a set of rules for encoding electronic document, documents in a format that is both human-readable and Machine-r ...
.
The goal was to provide a simpler alternative to the
DOM interface for accessing XML documents. E4X added XML as a
primitive data structure to allow for faster access and better support within the language.
E4X was standardized by
Ecma International
Ecma International () is a Nonprofit organization, nonprofit standards organization for information and communication systems. It acquired its current name in 1994, when the European Computer Manufacturers Association (ECMA) changed its name to ...
in th
ECMA-357 standard The first edition was published in June 2004 and the second edition in December 2005. However, the E4X standard was deprecated by the Mozilla Foundation in 2014, and it was withdrawn by ISO/IEC in 2021.
The first implementation of E4X was designed by Terry Lucas and John Schneider and appeared in
BEA'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.
Browser support
E4X is supported by Mozilla's
Rhino, as well as by
Tamarin, the JavaScript engine used in the
Flash virtual machine. However, it is not supported by other common engines like
Nitro
Nitro may refer to:
Chemistry
*Nitrogen, a chemical element and a gas except at very low temperatures, with which many compounds are formed:
**Nitro compound, an organic compound containing one or more nitro functional groups, -NO2
**Nitro ligand ...
(
Safari
A safari (; originally ) is an overland journey to observe wildlife, wild animals, especially in East Africa. The so-called big five game, "Big Five" game animals of Africa – lion, African leopard, leopard, rhinoceros, African elephant, elep ...
),
V8 (
Google Chrome
Google Chrome is a web browser developed by Google. It was first released in 2008 for Microsoft Windows, built with free software components from Apple WebKit and Mozilla Firefox. Versions were later released for Linux, macOS, iOS, iPadOS, an ...
),
Carakan (
Opera
Opera is a form of History of theatre#European theatre, Western theatre in which music is a fundamental component and dramatic roles are taken by Singing, singers. Such a "work" (the literal translation of the Italian word "opera") is typically ...
), and
Chakra (
Internet Explorer
Internet Explorer (formerly Microsoft Internet Explorer and Windows Internet Explorer, commonly abbreviated as IE or MSIE) is a deprecation, retired series of graphical user interface, graphical web browsers developed by Microsoft that were u ...
).
E4X was supported by
SpiderMonkey
SpiderMonkey is an open-source JavaScript and WebAssembly engine by the Mozilla Foundation. The engine powers the Firefox Web browser and has used multiple generations of JavaScript just-in-time (JIT) compilers, including TraceMonkey, Jäg ...
(used in
Firefox
Mozilla Firefox, or simply Firefox, is a free and open-source web browser developed by the Mozilla Foundation and its subsidiary, the Mozilla Corporation. It uses the Gecko rendering engine to display web pages, which implements curr ...
and
Thunderbird). However, E4X was deprecated in Firefox 10 and eventually removed in Firefox 21.
E4X was supported by the
OpenOffice.org software suite.
Example
var sales =
;
alert( sales.item.(@type "carrot").@quantity );
alert( sales.@vendor );
for each( var price in sales..@price )
delete sales.item
sales.item += ;
sales.item.(@type "oranges").@quantity = 4;
See also
*
JSX – an XML based markup specifically for DOM manipulation
References
External links
* ECMA-357 (withdraw
first editionsecond edition
E4X at faqts.com(or vi
WayBack Machine
Slides from 2005 E4X Presentation by Brendan Eich, Mozilla Chief ArchitectE4X at Mozilla Developer Center
compares E4X and json
Processing XML with E4Xat Mozilla Developer Center
at Yahoo Developer Network
{{DEFAULTSORT:Ecmascript For Xml
XML
Ecma standards