Jump to content

ECMAScript for XML

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by BalinKingOfMoria (talk | contribs) at 00:54, 17 August 2024 (Implementations: Remove excessive detail). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

ECMAScript for XML (E4X) was an extension to ECMAScript (which includes ActionScript, JavaScript, and JScript) to add native support for XML.[1] 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] 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.[3]

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] However, it is not supported by other common engines like Nitro (Safari), V8 (Google Chrome), Carakan (Opera), and Chakra (Internet Explorer and pre-Chromium Edge).[4]

E4X was supported by SpiderMonkey (used in Firefox and Thunderbird), but was deprecated in Firefox 10[5] and eventually removed in Firefox 21.[6][clarification needed]

E4X was used in the OpenOffice.org software suite.[citation needed]

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;

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.[citation needed] BEA's implementation was based on Rhino and released before the ECMAScript E4X spec was completed in June 2004.

  • E4X was implemented in SpiderMonkey (Gecko's JavaScript engine) since version 1.6.0[7] until version 20, and is in Rhino (Mozilla's other JavaScript engine written in Java instead of C) since version 1.6R1.[8]
  • As Mozilla Firefox 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 3 scripting language fully supports E4X. Early previews of ActionScript 3 were first made available in late 2005. Adobe officially released the language with Flash Player 9 on June 28, 2006.
  • E4X is available in Flash CS3, Adobe AIR and Adobe Flex as they use ActionScript 3 as a scripting language.
  • E4X is also available in Adobe Acrobat and Adobe Reader versions 8.0 or higher (notably[9] Forward Ported from SpiderMonkey version 17[10] and suggested may be dropped in the near future).
  • E4X is also available in Aptana'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.
  • E4X is available as part of Mirth Connect's JavaScript message transformation engine.

See also

  • JSX – an XML based markup specifically for DOM manipulation

References

  1. ^ 14:00-17:00. "ISO/IEC 22537:2006". ISO. Retrieved 2024-08-17. {{cite web}}: |last= has numeric name (help)
  2. ^ "E4X – Archive of obsolete content – MDN". Mozilla. Archived from the original on 24 July 2014. Retrieved 10 September 2014.
  3. ^ "ISO/IEC 22537:2006 — Information technology — ECMAScript for XML (E4X) specification — Status : Withdrawn".
  4. ^ "Issue 30975: Implement E4X Support for scripts and extensions". Google. Retrieved 21 May 2012.
  5. ^ "Firefox 10 for developers". Mozilla. Archived from the original on 5 May 2012. Retrieved 21 May 2012.
  6. ^ "E4X". Mozilla. Archived from the original on 30 September 2013. Retrieved 12 February 2013.
  7. ^ SpiderMonkey 1.6.0 release notes Archived 2009-04-15 at the Wayback Machine
  8. ^ Rhino 1.6R1 Change log
  9. ^ "Acrobat Help / New features summary". Retrieved 2015-07-16.
  10. ^ "15.008.20082 Planned Update, July 14, 2015". Retrieved 2015-07-16.