World Library  
Flag as Inappropriate
Email this Article

ECMAScript for XML

Article Id: WHEBN0002064230
Reproduction Date:

Title: ECMAScript for XML  
Author: World Heritage Encyclopedia
Language: English
Subject: JavaScript, XML, List of applications of near field communication, ActionScript, Linear Tape-Open
Collection:
Publisher: World Heritage Encyclopedia
Publication
Date:
 

ECMAScript for XML

ECMAScript for XML (E4X) is the standard ISO/IEC 22537:2006 [1] programming language extension that adds native XML support to ECMAScript (which includes ActionScript, JavaScript, and JScript). The goal is to provide an alternative to DOM 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. The standard E4X was deprecated by the Mozilla foundation.[1]

E4X is standardized by Ecma International in the ECMA-357 standard. The first edition was published in June 2004, the second edition in December 2005.

Browser support

E4X is supported by Mozilla's Tamarin, the JavaScript engine used in the Flash virtual machine. It is not supported by other common engines like Nitro (Safari), V8 (Google Chrome), Carakan (Opera), nor Internet Explorer.[2]

E4X was also supported by SpiderMonkey (used in Firefox and Thunderbird), but has been removed. In Firefox 10, E4X syntax was no longer accepted in SpiderMonkey when ECMAStrict 5 "strict mode" is enabled.[3] According to Brendan Eich, "This thus signals start of deprecation for E4X in SpiderMonkey."[4] 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"[5]

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;

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 and released before the ECMAScript E4X spec was completed in June 2004. John Schneider wrote an article on the XML extensions in BEA's Workshop at the time.

  • E4X was implemented in SpiderMonkey (Gecko's JavaScript engine) since version 1.6.0[6] until version 20, and is in Rhino (Mozilla's other JavaScript engine written in Java instead of C) since version 1.6R1.[7]
  • 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.
  • 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.

References

  1. ^ "E4X - Archive of obsolete content - MDN". Mozilla. Retrieved 10 September 2014. 
  2. ^ "Issue 30975: Implement E4X Support for scripts and extensions". Google. Retrieved 21 May 2012. 
  3. ^ "Firefox 10 for developers". Mozilla. Retrieved 21 May 2012. 
  4. ^ "Bug 695577 - E4X syntax should not be accepted in ES5 strict mode". Mozilla. Retrieved 21 May 2012. 
  5. ^ "E4X". Mozilla. Retrieved 12 February 2013. 
  6. ^ SpiderMonkey 1.6.0 release notes
  7. ^ Rhino 1.6R1 Change log

External links

  • ECMA-357 standard
  • E4X at faqts.com
  • Slides from 2005 E4X Presentation by Brendan Eich, Mozilla Chief Architect
  • E4X at Mozilla Developer Center
  • 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
  • Product showing E4X in action at Script Scraper.
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 


Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.