Chapter 15
632
you can see how Internet Explorer supports XML data islands, as shown below:
By embedding XML in this fashion, within the <XML> tag, we can use the data island as a data source (via
the datasrc attribute) for any data source-aware element. It so happens that <table> is such an element
in IE 5. Therefore, the HTML code segment below will display the XML data island in tabular form:
<table datasrc="#vacDeals" border="1">
<tr>
<td><div datafld="location"></div></td>
<td><div datafld="startdate"></div></td>
<td><div datafld="duration"></div></td>
</tr>
</table>
Another potentially very powerful feature, especially for JavaScript programmers, is that the elements in
the XML data island are actually accessible from the Dynamic HTML DOM (Document Object Model).
More specifically, JavaScript (or VBScript) code within the HTML page can actually read the elements
in the XML document as an extension of the document object model. This enables the script code to
read, format, or interpret the XML data. One may use Dynamic HTML to change the presentation
(using scripting code) or the user interface, based on the data.
We have a simple script segment within the IE5island.jsp file to demonstrate reading the XML data
using script:
<script>
document.write("The first special has a start date of " +
vacDeals.XMLDocument
.documentElement
.childNodes.item(0)
.childNodes.item(0)