IN THIS CHAPTER
Treating XML elements as objects
Creating XML data islands
Accessing XML element attributes
Using the XMLHttpRequest object
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.
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 either a static
.xml file or a web service that returns XML-structured data) into a web page without disturbing the HTML portion. Scripts could then use W3C DOM methods and properties to read the node tree as needed. Mozilla, Opera, and Safari browsers emulate the behavior of this
XMLHttpRequest control in a native object so that modern web applications can load external ...