To link an XML file to an HTML Web page

Source: Internet
Author: User
Tags object contains html page access
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. )



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.