XML Data Island

An XML data island is XML data embedded into a Microsoft introduced a special <xml> tag in Internet Explorer 4. This <xml> tag is used to create a XML data island that can hold XML to be used within the document. While querying a database, it is possible to bring more data than required from database and store it in XML data island. You may then allow the user to retrieve new information form the data island without going back to the server.

The following example explains the concept: Let us assume, we have the following XML file.

<?xml version = "1.0" encoding="ISO-8859-1"?>
 <name>James Fernandex</name>
 <title> Controller of Examination</title>

Next this XML document can be referenced in a HTML file by specifying it’s URL using the <xml> tag:

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

Once the XML file is included in the document, then it is possible to bind the XML elements to HTML tags. A very common requirement is to bind the XML data to a table.
Following code binds the staff.xml file to a table and converts the data into a html table.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<title>Employee Details</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<xml id="myisland" src="staff.xml"></xml>
<h1 align="center">Code Rewind Employee Directory</h1>
<table width="100%" datasrc="#myisland">
          <td><span datafld="name"></span></td>
          <td><span datafld="title"></span></td>
         <td><span datafld="phone"></span></td>
         <td><span datafld="email"></span></td>

You Might Also Like