21.8 E4X: ECMAScript for XML
Although it is an official standard, E4X is not yet widely enough deployed to warrant full coverage in this book. Despite its limited availability, though, the powerful and unique features of E4X deserve some coverage. This section presents an overview-by-example of E4X. Future editions of this book may expand the coverage.
In addition to this literal syntax, you can also work with XML parsed from strings. The following code adds another element to your periodic table:
When working with XML fragments, use
XMLList() instead of
* E4X is defined by the ECMA-357 standard. You can find the official specification at http://www.ecmainternational.org/publications/standards/Ecma-357.htm.