Displaying XML Data Islands with JavaScript-3 : Page 3

by Tom Duffy, DHTML Pro

May 15, 2001

Page 3 of 6

Create the Data Island in Your Web PageCreating the data island is actually the easiest part of the application. Simply add an <xml> element to your page and set its src attribute to point to the XML file you just created:

<xml id="data" src="data.xml"></xml>

Take note of the id attribute. IE5 uses that identifier for the XML DSO. From this point forward, you can refer to the DSO as "data" in script and you'll have access to all of the DOM and ADO properties of the DSO object. The <xml> element is an HTML element and requires a closing </xml> tag.

Alternatively, you can embed the data directly inside the <xml> element:

I find it more palatable to separate the data from its presentation so I recommend using an external filebut either method works just fine. In either case, IE5 creates an instance of the Microsoft XML (MSXML) DOMDocument object and loads the XML data into the object.