ECMAScript for XML
ECMAScript for XML (E4X) was an extension to ECMAScript (which includes ActionScript, JavaScript, and JScript) to add native support for XML.{{Cite web |title=ISO/IEC 22537:2006 Information technology – ECMAscript for XML: E4X specification |url=https://www.iso.org/standard/41002.html |access-date=2024-08-17 |website=International Organization for Standardization |language=en}} 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{{Clarification needed|date=August 2024}} and better support within the language.
E4X was standardized by Ecma International in the [https://web.archive.org/web/20131104082608/http://www.ecma-international.org/publications/standards/Ecma-357.htm 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,{{cite web|title=E4X – Archive of obsolete content – MDN|url=https://developer.mozilla.org/en-US/docs/Archive/Web/E4X|publisher=Mozilla|access-date=10 September 2014|archive-date=24 July 2014|archive-url=https://web.archive.org/web/20140724100129/https://developer.mozilla.org/en-US/docs/Archive/Web/E4X|url-status=dead}} 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.{{Citation needed|date=August 2024}} BEA's implementation was based on Rhino and released before the ECMAScript E4X spec was completed in June 2004.{{Citation needed|date=August 2024}}
Browser support
E4X is supported by Mozilla's Rhino, as well as by Tamarin, the JavaScript engine used in the Flash virtual machine.{{Citation needed|date=August 2024}} However, it is not supported by other common engines like Nitro (Safari), V8 (Google Chrome), Carakan (Opera), and Chakra (Internet Explorer).{{cite web|title=Issue 30975: Implement E4X Support for scripts and extensions|url=http://code.google.com/p/chromium/issues/detail?id=30975|access-date=21 May 2012}}
E4X was supported by SpiderMonkey (used in Firefox and Thunderbird). However, E4X was deprecated in Firefox 10{{cite web |title=Firefox 10 for developers |url=https://developer.mozilla.org/en/Firefox_10_for_developers#JavaScript |archive-url=https://web.archive.org/web/20120505042844/https://developer.mozilla.org/en/Firefox_10_for_developers#JavaScript |archive-date=5 May 2012 |access-date=21 May 2012 |publisher=Mozilla}} and eventually removed in Firefox 21.{{cite web |title=E4X |url=https://developer.mozilla.org/en-US/docs/E4X |archive-url=https://web.archive.org/web/20130930214422/https://developer.mozilla.org/en-US/docs/E4X |archive-date=30 September 2013 |access-date=12 February 2013 |publisher=Mozilla}}{{Clarification needed|reason=Was it removed from SpiderMonkey at the same time?|date=August 2024}}
E4X was supported by the OpenOffice.org software suite.{{Citation needed|date=August 2024}}
Example
var sales =
;
alert( sales.item.(@type == "carrot").@quantity );
alert( sales.@vendor );
for each( var price in sales..@price ) {
alert( price );
}
delete sales.item[0];
sales.item +=
sales.item.(@type == "oranges").@quantity = 4;
See also
- JSX – an XML based markup specifically for DOM manipulation
References
{{Reflist}}
External links
- ECMA-357 (withdrawn [http://www.ecma-international.org/publications/files/ECMA-ST-WITHDRAWN/ECMA-357,%201st%20edition,%20June%202004.pdf first edition], [http://www.ecma-international.org/publications/files/ECMA-ST-WITHDRAWN/Ecma-357.pdf second edition])
- [http://www.faqts.com/knowledge_base/index.phtml/fid/1762 E4X at faqts.com] (or via [https://web.archive.org/web/20090129224344/http://faqts.com/knowledge_base/index.phtml/fid/1762 WayBack Machine])
- [https://web.archive.org/web/20081005063311/http://developer.mozilla.org/presentations/xtech2005/e4x/ Slides from 2005 E4X Presentation by Brendan Eich, Mozilla Chief Architect]
- [https://developer.mozilla.org/en/docs/E4X E4X at Mozilla Developer Center] {{Webarchive|url=https://web.archive.org/web/20080419080706/https://developer.mozilla.org/en/docs/E4X |date=2008-04-19 }}
- [http://www.xml.com/pub/a/2007/11/28/introducing-e4x.html Introducing E4X at xml.com]: compares E4X and json
- [https://web.archive.org/web/20081006212236/http://developer.mozilla.org/index.php?title=En%2FCore_JavaScript_1.5_Guide%2FProcessing_XML_with_E4X Processing XML with E4X] at Mozilla Developer Center
- [https://web.archive.org/web/20080704203050/http://developer.yahoo.com/flash/articles/e4x-beginner-to-advanced.html E4X: Beginner to Advanced] at Yahoo Developer Network
{{-}}
{{Ecma International Standards}}
{{ISO standards}}
{{List of IEC standards}}
{{DEFAULTSORT:Ecmascript For Xml}}