请输入您要查询的百科知识:

 

词条 ECMAScript for XML
释义

  1. Browser support

  2. Example

  3. Implementations

  4. References

  5. External links

ECMAScript for XML (E4X) is the standard ISO/IEC 22537:2006   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.

E4X is 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, the second edition in December 2005.

The E4X standard was deprecated by the Mozilla Foundation in 2014.[1]

Browser support

E4X is supported by Mozilla's Rhino, used in OpenOffice.org and several other projects. It is also supported by 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), Chakra (Internet Explorer) and Chakra (Edge).[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 ECMAScript 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 ) {

}

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 [https://web.archive.org/web/20080403052807/http://dev2dev.bea.com/pub/a/2002/09/JSchneider_XML.html 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 (notably[8] Forward Ported from SpiderMonkey version 17[9] 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.

References

1. ^{{cite web|title=E4X - Archive of obsolete content - MDN|url=https://developer.mozilla.org/en-US/docs/Archive/Web/E4X|publisher=Mozilla|accessdate=10 September 2014}}
2. ^{{cite web|title=Issue 30975: Implement E4X Support for scripts and extensions|url=http://code.google.com/p/chromium/issues/detail?id=30975|publisher=Google|accessdate=21 May 2012}}
3. ^{{cite web|title=Firefox 10 for developers|url=https://developer.mozilla.org/en/Firefox_10_for_developers#JavaScript|publisher=Mozilla|accessdate=21 May 2012|deadurl=yes|archiveurl=https://web.archive.org/web/20120505042844/https://developer.mozilla.org/en/Firefox_10_for_developers#JavaScript|archivedate=5 May 2012|df=}}
4. ^{{cite web|title=Bug 695577 - E4X syntax should not be accepted in ES5 strict mode|url=https://bugzilla.mozilla.org/show_bug.cgi?id=695577#c1|publisher=Mozilla|accessdate=21 May 2012}}
5. ^{{cite web|title=E4X|url=https://developer.mozilla.org/en-US/docs/E4X|publisher=Mozilla|accessdate=12 February 2013}}
6. ^[https://www.mozilla.org/js/spidermonkey/release-notes/JS_160.html SpiderMonkey 1.6.0 release notes] {{webarchive|url=https://web.archive.org/web/20090415002451/http://www.mozilla.org/js/spidermonkey/release-notes/JS_160.html |date=2009-04-15 }}
7. ^[https://www.mozilla.org/rhino/rhino16R1.html Rhino 1.6R1 Change log]
8. ^{{cite web|url=http://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotes/DC/dccontinuousjuly2015.html|accessdate=2015-07-16|title=Acrobat Help / New features summary}}
9. ^{{cite web|url=https://helpx.adobe.com/acrobat/using/whats-new.html|accessdate=2015-07-16|title=15.008.20082 Planned Update, July 14, 2015}}

External links

  • ECMA-357 (withdrawn first edition, second edition)
  • E4X at faqts.com (or via [https://web.archive.org/web/20090129224344/http://faqts.com/knowledge_base/index.phtml/fid/1762 WayBack Machine])
  • [https://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]
  • 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
  • Product showing E4X in action at Script Scraper.
{{Ecma International Standards}}{{DEFAULTSORT:Ecmascript For Xml}}

2 : XML|Ecma standards

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/9/22 1:11:17