There are several syntax extensions. The most important are XML literals (see Sections 11.1.4 and 11.1.5):
var foo = <xml> foo </xml>; var bar = <> <tag attr={(1+2).toFixed(2)}/> {foo} </>;
The above example shows a special case of an empty root tag and JavaScript expressions in XML code.
You also have some expressions that are not valid in ECMA-262 (see section 11.2):
xml.@attr // get attribute attr xml.* // get all child elements xml.@ * // get all attributes xml..foo // get all <foo> tags xml..foo.(@id == 1) // filter <foo> tags by id attribute
Namespaces exist (see section 11.1.2):
xml.soap::foo
There is a default namespace XML operator, which is a syntactically very unusual construct (see section 12.1):
default xml namespace = new Namespace("http://foo/bar");
Finally, there is a for each .. in loop, which is similar to for .. in (see section 12.3):
for each (var foo in xml) { }
As far as I know, these are all differences in syntax, but you probably already got more than enough.
source share