ECMAScript for XML: Difference between revisions
imported>Winderz IoT m →Browser support: This only links to the Internet Explorer version |
imported>Jerryobject MOS:FIRSTABBReviations define-clarify before parenthetic WP:ABBRs. WP:LINKs: needless-WP:PIPEs > WP:NOPIPEs, update-standardizes. Template:Clarification needed update > Template:Clarify. Adds: MOS:COMMENT, WP:CATEGORY. |
||
| Line 1: | Line 1: | ||
'''ECMAScript for XML''' ('''E4X''') was an extension to [[ECMAScript]] (which includes [[ActionScript]], [[JavaScript]], and [[JScript]]) to add native support for [[XML]].<ref name="ISO 22537:2006">{{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}}</ref> The goal was to provide a simpler alternative to the [[Document Object Model | '''ECMAScript for XML''' ('''E4X''') was an extension to [[ECMAScript]] (which includes [[ActionScript]], [[JavaScript]], and [[JScript]]) to add native support for Extensible Markup Language ([[XML]]).<ref name="ISO 22537:2006">{{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}}</ref> The goal was to provide a simpler alternative to the [[Document Object Model]] (DOM) interface for accessing XML documents. E4X added XML as a [[primitive (computer science)|primitive]] data structure to allow faster access{{Clarify|date=August 2024|reason="access" to what?}} 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,<ref>{{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}}</ref> and it was withdrawn by ISO/IEC in 2021.<ref name="ISO 22537:2006" /> | 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,<ref>{{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}}</ref> and it was withdrawn by ISO/IEC in 2021.<ref name="ISO 22537:2006" /> | ||
| Line 6: | Line 6: | ||
==Browser support== | ==Browser support== | ||
E4X is supported by Mozilla's [[Rhino (JavaScript engine)|Rhino]], as well as by [[Tamarin ( | E4X is supported by Mozilla's [[Rhino (JavaScript engine)|Rhino]], as well as by [[Tamarin (software)|Tamarin]], the JavaScript engine used in the [[Adobe Flash|Flash]] virtual machine.{{Citation needed|date=August 2024}} However, it is unsupported by other common engines like [[WebKit#JavaScriptCore|Nitro]] ([[Safari (web browser)|Safari]]), [[V8 (JavaScript engine)|V8]] ([[Google Chrome]]), [[Presto (browser engine)#ECMAScript engines|Carakan]] ([[Opera (web browser)|Opera]]), and [[Chakra (JScript engine)|Chakra]] ([[Internet Explorer]]).<ref>{{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}}</ref> | ||
E4X was supported by [[ | E4X was supported by [[SpiderMonkey]] (used in [[Firefox]] and [[Mozilla Thunderbird|Thunderbird]]). However, E4X was deprecated in Firefox 10<ref>{{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}}</ref> and eventually removed in Firefox 21.<ref>{{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}}</ref>{{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}} | E4X was supported by the [[OpenOffice.org]] software suite.{{Citation needed|date=August 2024}} | ||
| Line 31: | Line 31: | ||
==See also== | ==See also== | ||
* [[JSX (JavaScript) | * [[JSX (JavaScript)]] – an XML based markup specifically for DOM manipulation | ||
==References== | ==References== | ||
| Line 45: | Line 45: | ||
* [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 | * [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}} | {{Ecma International Standards}} | ||
{{ISO standards}} | {{ISO standards}} | ||
| Line 53: | Line 52: | ||
[[Category:XML]] | [[Category:XML]] | ||
[[Category:Ecma standards]] | [[Category:Ecma standards]] | ||
<!-- Hidden categories below --> | |||
[[Category:Articles with example JavaScript code]] | |||
Latest revision as of 19:09, 21 June 2025
ECMAScript for XML (E4X) was an extension to ECMAScript (which includes ActionScript, JavaScript, and JScript) to add native support for Extensible Markup Language (XML).[1] The goal was to provide a simpler alternative to the Document Object Model (DOM) interface for accessing XML documents. E4X added XML as a primitive data structure to allow faster accessTemplate:Clarify and better support within the language.
E4X was standardized by Ecma International in the 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,[2] and it was withdrawn by ISO/IEC in 2021.[1]
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.Script error: No such module "Unsubst". BEA's implementation was based on Rhino and released before the ECMAScript E4X spec was completed in June 2004.Script error: No such module "Unsubst".
Browser support
E4X is supported by Mozilla's Rhino, as well as by Tamarin, the JavaScript engine used in the Flash virtual machine.Script error: No such module "Unsubst". However, it is unsupported by other common engines like Nitro (Safari), V8 (Google Chrome), Carakan (Opera), and Chakra (Internet Explorer).[3]
E4X was supported by SpiderMonkey (used in Firefox and Thunderbird). However, E4X was deprecated in Firefox 10[4] and eventually removed in Firefox 21.[5]Template:Clarification needed
E4X was supported by the OpenOffice.org software suite.Script error: No such module "Unsubst".
Example
var sales = <sales vendor="John">
<item type="peas" price="4" quantity="6"/>
<item type="carrot" price="3" quantity="10"/>
<item type="chips" price="5" quantity="3"/>
</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 += <item type="oranges" price="4"/>;
sales.item.(@type == "oranges").@quantity = 4;
See also
- JSX (JavaScript) – an XML based markup specifically for DOM manipulation
References
External links
- ECMA-357 (withdrawn first edition, second edition)
- E4X at faqts.com (or via WayBack Machine)
- Slides from 2005 E4X Presentation by Brendan Eich, Mozilla Chief Architect
- E4X at Mozilla Developer Center Template:Webarchive
- Introducing E4X at xml.com: compares E4X and json
- Processing XML with E4X at Mozilla Developer Center
- E4X: Beginner to Advanced at Yahoo Developer Network
Template:Ecma International Standards Template:ISO standards Template:List of IEC standards