IN THIS CHAPTER
Treating XML elements as objects
Creating XML data islands
Accessing XML element attributes
Using the XMLHttpRequest object
Using E4X to create dynamic XML objects
XML (eXtensible Markup Language) is an undeniably hot topic in the Internet world, and has been for the past few years. Not only has the W3C organization formed multiple working groups and recommendations for XML and its offshoots, but the W3C DOM recommendation also has XML in mind when it comes to defining how elements, attributes, and data of any kind—not just the HTML vocabulary—are exposed to browsers as an object model. Most of the arcana of the W3C DOM Core specification—especially the structure based on the node—are in direct response to the XML possibilities of documents that are beginning to travel the Internet.
ECMAScript for XML (E4X) is a standardized programming language extension that provides native XML support to ECMAScript as a primitive type, at the same level as strings, numbers, and Booleans. It has been supported since FireFox 1.5, but is not supported as of Safari 4.0.4, Google Chrome 126.96.36.1995, Opera 10.51, or IE 8.
During its early explorations into XML and browsers, Microsoft devised a custom HTML element—the
<xml> tag—that allowed authors to embed XML data into an HTML document. These tags created what were called XML data islands. A more practical solution came slightly later with the creation of an ActiveX control that could retrieve XML data (from ...