Browse DevX
Sign up for e-mail newsletters from DevX


Displaying XML Data Islands with JavaScript-3 : Page 3




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Create the Data Island in Your Web Page
Creating 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:

<xml id="data"> <?xml version="1.0"?> <!&#151;XML goes here --> </xml>

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.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date