http://dev2dev.bea.com/products/wlworkshop/articles/jschneider_xml.jsp
I wanted to write "predict as true", because I described my idea with PT, that is, a dedicated XML programming language. However, the time of this article is probabulous than I have to form this idea. Therefore, for the exemption, Zhuge Liang, I used "I saw it" as the title. : P
For the words, the article is said to be the ECMA Leading E4X (ECMAScript for XML) - another generation: The next generation of Ecmascript Edition 4 (Aka JavaScript 2.0) has been so many years, still there is no indication, 都 不 不 不But I didn't see this feature on the PPT of JS2.
It is mainly to add direct XML support in JS: First-CLASS CITIN:
Direct XML Literals (such as: VAR x =
Compare it with several built-in XML support (of course, Native XML scripting), such as the SIMPLEXML module and Groovy of PHP5. Summary, a few design considerations:
XML Output: The simple nested structure of XML Litral and Script, the main purpose is to use the output of XML. E4X is the abbreviation method of the target attribute from the XSLT to XQuery's {} structure. PHP itself has a convenient embedded syntax, so there is no additional design. Groovy has more ways to use Closure's Markup Builder in general embedded grammar, and there is no such design.
XML tree traversal and filtering: Basic practice is to convert to Object, then use the language itself traversal characteristics (Array, List, Map, etc.). Groovy's GPath says is to XPath. I personally feel a problem with GPath is confusing in some places, such as how to distinguish the FindAll method and a FindAll method on a gpath (although it is necessary to follow a closure after findall). In addition, it does not seem to // equivalents. E4X uses .. as //, although it is also logical, it always feels uncomfortable (because the parent is used in Xpath .. One of the specials of PHP is unlike JS or Groovy. and [] is equivalent, it uses -> to get the element, use [] to get the property, not directly borrow @ATTR's representation, so it does not Support direct filtering (not there is -> XPath syntax, there is a need to use XPath directly). Basically, from the simple and expressive power of Expression, there is a big gap with XPath. Personally, use the XPath syntax to be better.