xml| link | Web page
To access an XML file using the DOM, you must link the XML file to an HTML Web page. The easiest way to achieve this is to insert a data island. Recall that we used an HTML element named XML to create a data island. For example, the BODY element in the following HTML page contains a link that is contained in the data island of an XML file in a Book.xml file:
<BODY>
<xml id= "Dsobook" src= "Book.xml" ></XML>
<!--other elements in the body of page ...-->
</BODY>
For more information about data island, see the first step in chapter eighth: Linking an XML file to an HTML page.
As you learned in the eighth chapter, the ID you assign to data island will refer to the file's DSO. You will use the DSO's object member XmlDocument to access the DOM, as shown in the following line of script code:
Document =dsobook.xmldocument;
In particular, the XmlDocument member contains the root object of the DOM, called the file node. You will use the file node to access all other DOM objects.
Therefore, creating a data island in an HTML Web page will cause Internet Explorer 5 to simultaneously establish the DSO (directly represented by the ID of the data island) and Dom (accessed through the XmlDocument member object of the DSO).
Tips
If you want to access multiple XML files from an HTML page, you can do this by adding a data island to each XML file. Even a single XML file can contain multiple data island. (If your Web page changes the content of the DOM data in the cache, then this technique may be useful for managing several different versions of the XML data.) However, this chapter does not include techniques for modifying DOM data. )