ECMAScript for XML

from Wikipedia, the free encyclopedia

ECMAScript for XML ( E4X for short ) is a standardized programming language extension for JavaScript and similar languages ​​that follow the ECMAScript standard. The extension makes it possible to use regular XML and HTML elements as a native part of the programming language.

example

With E4X it is possible to set variables in the XML elements. Attributes can also be addressed directly. In JavaScript this looks like this:

var a = 'Wikipedia';
var anchor = <a href="http://wikipedia.org/">{a}</a>;
anchor.@href = 'http://de.wikipedia.org/';
document.write(anchor); // Ergibt: <a href="http://de.wikipedia.org/">Wikipedia</a>

Note the missing quotation marks when assigning values ​​to the variable anchor.

Implementations and support

E4X is partially implemented in the Gecko engine used by Mozilla Firefox as well as in SpiderMonkey and Rhino . E4X support was completely removed with Mozilla Firefox 21. E4X fully supports the programming and scripting language ActionScript 3 .

standardization

E4X is standardized by Ecma International in the ECMA-357 standard (currently in the second version from December 2005). E4X is also specified by the ISO in ISO / IEC 22537 (currently in the first version from February 2006).

E4X is now (March 2013) obsolete (overtaken by DOM possibilities). JXON is recommended as an alternative.

Web links

Individual evidence

  1. Introduction to the ECMA-357 standard, online at ecma-international.org ( memento of the original dated November 4, 2013 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice. Retrieved September 13, 2011 @1@ 2Template: Webachiv / IABot / www.ecma-international.org
  2. developer.mozilla.org
  3. E4X (English) . Mozilla. Retrieved December 9, 2015.