Article

XML and Web Services for Microsoft Developers - Part 1

Page: 1 2 3 4 5 6 Next

XML and Internet Explorer

Beginning with Internet Explorer 5.0, Microsoft introduced the notion of XML Data Islands, which refers to the ability of including chunks of XML data inside the HTML Web page. These islands of XML data inside the Web pages then can be bound to HTML controls, such as tables, or processed using client-side JScript or VBScript. The Internet Explorer browser internally uses MSXML to offer the Data Island functionality.

Let's now look at an example that makes use of Internet Explorer's XML Data Island feature. For this example to work, you'll need IE 5.0 or higher.

<html>    
<head>    
 <title>Data Island Example</title>    
 <style>    
   BODY, A, LI, TD  {    
     font-family: 'Verdana', 'Arial', sans-serif;    
     font-size: 9pt;    
     color : black;    
   }    
 </style>    
   
<XML ID="SITES">    
<Sites>    
 <Site>    
   <URL>www.SitePoint.com</URL>    
   <Title>SitePoint Hub</Title>    
 </Site>    
 <Site>    
   <URL>www.WebmasterBase.com</URL>    
   <Title>Build your Site</Title>    
 </Site>    
 <Site>    
   <URL>www.eCommerceBase.com</URL>    
   <Title>Make Money</Title>    
 </Site>    
 <Site>    
   <URL>www.PromotionBase.com</URL>    
   <Title>Increase Traffic</Title>    
 </Site>    
 <Site>    
   <URL>www.ServicesBase.com</URL>    
   <Title>Web Tools and Services</Title>    
 </Site>    
 <Site>    
   <URL>www.SitePointForums.com</URL>    
   <Title>Help Community</Title>    
 </Site>    
</Sites>    
</XML>    
</head>    
   
<body>    
 <div align="center">    
 <h2>SitePoint.com</h2>    
   
 <table width="100%" cellpadding="2"    
    cellspacing="1" border="0" bgcolor="#EEEEEE"    
    DATASRC="#SITES">    
   <thead>    
     <th>Title</th>    
     <th>URL</th>    
   </thead>    
   <tr>    
     <td bgcolor="#FFFFFF"><div DATAFLD="Title"></div></td>    
     <td bgcolor="#FFFFFF"><div DATAFLD="URL"></div></td>    
   </tr>    
 </table>    
 </div>    
</body>    
</html>

Inside an HTML Web page, we can include XML data using the <XML></XML> tag. The above HTML page contains the XML Data Island named SITES and then later binds this data to a table using the DATASRC and DATAFLD attributes.

Browse to the above HTML page and you'll see the output similar to shown in the following screen:

950_screen2

Figure 2 XML Data Island bound to a table control inside an HTML page

This concludes our discussion on MSXML. Let's now explore the XML features in SQL Server 2000.

If you liked this article, share the love:
Print-Friendly Version Suggest an Article

Sponsored Links