ECMAScript for XML (E4X) is the standar
programming language
A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language.
The description of a programming ...
extension that adds native
XML
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable ...
support to
ECMAScript
ECMAScript (; ES) is a JavaScript standard intended to ensure the interoperability of web pages across different browsers. It is standardized by Ecma International in the documenECMA-262
ECMAScript is commonly used for client-side scripting o ...
(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 (meaning i ...
,
JavaScript
JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
, and
JScript
JScript is Microsoft's legacy dialect of the ECMAScript standard that is used in Microsoft's Internet Explorer 11 and older.
JScript is implemented as an Active Scripting engine. This means that it can be "plugged in" to OLE Automation applicati ...
). The goal is to provide an alternative to
DOM Dom or DOM may refer to:
People and fictional characters
* Dom (given name), including fictional characters
* Dom (surname)
* Dom La Nena (born 1989), stage name of Brazilian-born cellist, singer and songwriter Dominique Pinto
* Dom people, an et ...
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 () is a 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 reflect the organizatio ...
in th
ECMA-357 standard The first edition was published in June 2004, the second edition in December 2005.
The E4X standard was deprecated by the Mozilla Foundation in 2014.
Browser support
E4X is supported by Mozilla's
Rhino
A rhinoceros (; ; ), commonly abbreviated to rhino, is a member of any of the five extant species (or numerous extinct species) of odd-toed ungulates in the family Rhinocerotidae. (It can also refer to a member of any of the extinct species o ...
, used in
OpenOffice.org
OpenOffice.org (OOo), commonly known as OpenOffice, is a discontinued open-source office suite. Active successor projects include LibreOffice (the most actively developed), Apache OpenOffice, Collabora Online (enterprise ready LibreOffice) a ...
and several other projects. It is also supported by
Tamarin
The tamarins are squirrel-sized New World monkeys from the family Callitrichidae in the genus ''Saguinus''. They are the first offshoot in the Callitrichidae tree, and therefore are the sister group of a clade formed by the lion tamarins, Goel ...
, the JavaScript engine used in the
Flash
Flash, flashes, or FLASH may refer to:
Arts, entertainment, and media
Fictional aliases
* Flash (DC Comics character), several DC Comics superheroes with super speed:
** Flash (Barry Allen)
** Flash (Jay Garrick)
** Wally West, the first Kid ...
virtual machine. 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
**Nitroalkene, ...
(
Safari
A safari (; ) is an overland journey to observe wild animals, especially in eastern or southern Africa. The so-called "Big Five" game animals of Africa – lion, leopard, rhinoceros, elephant, and Cape buffalo – particularly form an importa ...
),
V8 (
Google Chrome
Google Chrome is a cross-platform 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 ...
),
Carakan (
Opera
Opera is a form of theatre in which music is a fundamental component and dramatic roles are taken by singers. Such a "work" (the literal translation of the Italian word "opera") is typically a collaboration between a composer and a librett ...
),
Chakra
Chakras (, ; sa , text=चक्र , translit=cakra , translit-std=IAST , lit=wheel, circle; pi, cakka) are various focal points used in a variety of ancient meditation practices, collectively denominated as Tantra, or the esoteric or ...
(
Internet Explorer
Internet Explorer (formerly Microsoft Internet Explorer and Windows Internet Explorer, commonly abbreviated IE or MSIE) is a series of graphical user interface, graphical web browsers developed by Microsoft which was used in the Microsoft Wind ...
and pre-Chromium
Edge
Edge or EDGE may refer to:
Technology Computing
* Edge computing, a network load-balancing system
* Edge device, an entry point to a computer network
* Adobe Edge, a graphical development application
* Microsoft Edge, a web browser developed by ...
).
E4X was also supported by
SpiderMonkey
SpiderMonkey is the first JavaScript engine, written by Brendan Eich at Netscape Communications, later released as open source and currently maintained by the Mozilla Foundation. It is used in the Firefox web browser.
History
Eich "wrote ...
(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 current and ...
and
Thunderbird
Thunderbird, thunder bird or thunderbirds may refer to:
* Thunderbird (mythology), a legendary creature in certain North American indigenous peoples' history and culture
* Ford Thunderbird, a car
Birds
* Dromornithidae, extinct flightless birds ...
), but has been removed. In Firefox 10, E4X syntax was no longer accepted in SpiderMonkey when
ECMAScript 5 "strict mode" is enabled. According to
Brendan Eich
Brendan Eich (; born July 4, 1961) is an American computer programmer and technology executive. He created the JavaScript programming language and co-founded the Mozilla project, the Mozilla Foundation, and the Mozilla Corporation. He served as ...
, "This thus signals start of deprecation for E4X in SpiderMonkey." and "has been disabled by default for webpages (content) in Firefox 17, disabled by default for chrome in Firefox 20, and has been removed in Firefox 21"
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;
Implementations
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
A rhinoceros (; ; ), commonly abbreviated to rhino, is a member of any of the five extant species (or numerous extinct species) of odd-toed ungulates in the family Rhinocerotidae. (It can also refer to a member of any of the extinct species o ...
and released before the ECMAScript E4X spec was completed in June 2004. John Schneider wrote a
articleon the XML extensions in BEA's Workshop at the time.
* E4X was implemented in
SpiderMonkey
SpiderMonkey is the first JavaScript engine, written by Brendan Eich at Netscape Communications, later released as open source and currently maintained by the Mozilla Foundation. It is used in the Firefox web browser.
History
Eich "wrote ...
(
Gecko
Geckos are small, mostly carnivorous lizards that have a wide distribution, found on every continent except Antarctica. Belonging to the infraorder Gekkota, geckos are found in warm climates throughout the world. They range from .
Geckos ar ...
's JavaScript engine) since version 1.6.0 until version 20, and is in
Rhino
A rhinoceros (; ; ), commonly abbreviated to rhino, is a member of any of the five extant species (or numerous extinct species) of odd-toed ungulates in the family Rhinocerotidae. (It can also refer to a member of any of the extinct species o ...
(Mozilla's other JavaScript engine written in Java instead of C) since version 1.6R1.
* As
Mozilla 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 current and a ...
is based on Gecko, older versions could be used to run scripts using E4X. But this feature is deprecated since release 16 and removed in release 18.
* Adobe's
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 (meaning i ...
3 scripting language fully supports E4X. Early previews of
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 (meaning i ...
3 were first made available in late 2005. Adobe officially released the language with
Flash Player
Adobe Flash Player (known in Internet Explorer, Firefox, and Google Chrome as Shockwave Flash) is computer software for viewing multimedia contents, executing rich Internet applications, and streaming audio and video content created on the ...
9 on June 28, 2006.
* E4X is available in
Flash CS3,
Adobe AIR
Adobe AIR (also known as Adobe Integrated Runtime and is codenamed Apollo) is a cross-platform runtime system currently developed by Harman International, in collaboration with Adobe Inc., for building desktop applications and mobile applicat ...
and
Adobe Flex
Apache Flex, formerly Adobe Flex, is a software development kit (SDK) for the development and deployment of cross-platform rich web applications based on the Adobe Flash platform. Initially developed by Macromedia and then acquired by Adobe Syste ...
as they use ActionScript 3 as a scripting language.
* E4X is also available in
Adobe Acrobat
Adobe Acrobat is a family of application software and Web services developed by Adobe Inc. to view, create, manipulate, print and manage Portable Document Format (PDF) files.
The family comprises Acrobat Reader (formerly Reader), Acrobat (forme ...
and
Adobe Reader
Adobe Acrobat is a family of application software and Web services developed by Adobe Inc. to view, create, manipulate, print and manage Portable Document Format (PDF) files.
The family comprises Acrobat Reader (formerly Reader), Acrobat (former ...
versions 8.0 or higher (notably Forward Ported from SpiderMonkey version 17
and suggested may be dropped in the near future).
* E4X is also available in
Aptana
Aptana, Inc. is a company that makes web application development tools for use with a variety of programming languages (such as JavaScript, Ruby, PHP and Python). Aptana's main products include Aptana Studio, Aptana Cloud and Aptana Jaxer.
Aptan ...
'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
A document management system (DMS) is usually a computerized system used to store, share, track and manage files or documents. Some systems include history tracking where a log of the various versions created and modified by different users is r ...
.
* E4X is available as part of
Mirth Connect
Mirth Connect is a cross-platform interface engine used in the healthcare industry that enables the management of information using bi-directional sending of many types of messages. The primary use of this interface engine is in healthcare.
On ...
's JavaScript message transformation engine.
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