Description This sample will demonstrate the basics of using XML data islands and the XML parser object in Internet Explorer 5. It provides a working example of using the XML parser to dynamically retrieve additional data from a web server in response to a users selection.

More Details
The sample application uses data from the 1999 All Star Baseball game. This data is stored in two files: american_allstar.xml and national_allstar.xml. The application presents a rather simplistic user interface that consists of an American and National button. Based on which button that the user clicks on, the application will retrieve the information contained in the american_allstar.xml or national_allstar.xml files.

The application renders the data for display by programmatically walking through the retrieved XML data, and generating the appropriate HTML.

This sample application does not require a web server. The XML data islands will simply retrieve the data from the xml files that are stored locally on the file system.

There are two versions of the sample application:

Sample1.htm uses the XML Data Island feature of Internet Explorer 5 to retrieve the requested data. Sample2.htm explicitly creates an instance of the XML Parser object using JavaScript.

Sample1.htm uses an XML data island called xmlData to retrieve the XML from the XML data files. Sample2.htm explicitly creates an instance of the XML parser object using JavaScript. This demonstrates that the use of data islands in Internet Explorer 5.0 is functionally equivalent to explicitly creating instances of the XML parser object.

In both cases, the XML data retrieved is transformed into an HTML element using the generateHTML helper function that takes a reference to an XML parser object as an argument. Browser/Platform Compatibility
This sample requires Internet Explorer 5.0 on the Win32 and UNIX platform.

Complete Articles

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish