正式名称はECMAScript for XML
ECMA-357として標準化
ECMAScriptでXMLを簡単に扱う仕組み
Gecko 1.8.0 / Firefox 1.5でのサポート
Firefox 21で完全に削除
Rhino 1.6R1で実装
By BEA and AgileDelta
http://docs.oracle.com/javase/6/docs/technotes/guides/scripting/programmer_guide/index.html#jsengine
ActionScript 3でサポート
Flash 9+
AIR 1.0+
XHTML 1.0 (this specification) is the first document type in the XHTML family. It is a reformulation of the three HTML 4 document types as applications of XML 1.0 [XML]. It is intended to be used as a language for content that is both XML-conforming and, if some simple guidelines are followed, operates in HTML 4 conforming user agents. Developers who migrate their content to XHTML 1.0 will realize the following benefits:
The rationale: E4X has a standard, but is not part of the de facto open web: for a long time, it's implemented by only one browser, Firefox, and is not used for open web content. We are trying to advance SpiderMonkey and Firefox rapidly under intense competition, and keeping E4X slows down our development and increases the security attack surface.
https://groups.google.com/forum/#!topic/mozilla.dev.tech.js-engine/yYQyMCcMf-0/discussion
<script type="text/javascript;e4x=1"> ... </script>
XMLコンストラクタの引数としてXMLを渡す
var a = new XML("<a></a>");
もっと簡単にリテラルを使う
var a = <a></a>;
要素の属性を設定
a.@type = "abc"
要素属性を参照
a.@type
a.b.c
または
a['b']
テキストノード
a.text()
XMLノード
a.toXMLString()
すべての子ノード
a.*
XMLListとして返る
XMLListの参照にfor each...in
for each (var childnode in a.b) { }
a.(@id == "abc")
Looks pretty neat. It'd be good if this functionality could be added directly to V8, but I've heard they aren't fond of implementing stuff that isn't part of the core standards.