Home arrow XML arrow Page 2 - The Why and How of XML Data Islands

The Why and How of XML Data Islands

This article explains a useful way to embed data in an HTML document, and store it on the client, using XML. With XML becoming ever more pervasive and the client side implementation gaining a lot of ground, you will probably find yourself using this technique in many projects.

Author Info:
By: Jayaram Krishnaswamy
Rating: 5 stars5 stars5 stars5 stars5 stars / 28
July 19, 2006
  1. · The Why and How of XML Data Islands
  2. · Getting the names of students
  3. · Showing the complete data
  4. · HTML tags that can be bound to an XML island

print this article

The Why and How of XML Data Islands - Getting the names of students
(Page 2 of 4 )

It was mentioned that the XML data island represents the built-in Data Source Object DATASRC, which is identified by the id property. Associated with the data source are its fields, which are identified by the DATAFLD property. For example, the student "Linda Jones" will fit in as a DATAFLD. Let's add the following HTML code to this file:

<table DATASRC="#WebStudents">
<td><span DATAFLD="name"></span></td>

and call the new file Basic.htm, whose source is shown in the next paragraph:

<h3>Html file with embedded XML</h3> <P>Here begins the XML Data Island</P> <xml id="WebStudents"> <wclass> <!-- My students who attended my web programming class --> <student id="1"> <name>Linda Jones</name> <legacySkill>Access, VB5.0</legacySkill> </student> <student id="2"> <name>Adam Davidson</name> <legacySkill>Cobol, MainFrame</legacySkill> </student> <student id="3"> <name>Charles Boyer</name> <legacySkill>HTML, Photoshop</legacySkill> </student> <student id="4"> <name>Charles Mann</name> <legacySkill>Cobol, MainFrame</legacySkill> </student> </wclass> </xml> <P>Here ends the XML Data Island</P> <table DATASRC="#WebStudents"> <tr> <td><span DATAFLD="name"></span></td> </tr> </table>  </BODY> </HTML>

In the above added snippet, you have identified the DATASRC as "#WebStudents" and out of the three elements, student id, name, and legacySkill you have opted to show only the "name." Now if you browse the file Basic.htm, your display will appear as shown in the next picture. Although you have only a single <td/> element, you have all the rows of data.


blog comments powered by Disqus

- Open XML Finally Supported by MS Office
- XML Features Added to Two Systems
- Using Regions with XSL Formatting Objects
- Using XSL Formatting Objects
- More Schematron Features
- Schematron Patterns and Validation
- Using Schematron
- Datatypes and More in RELAX NG
- Providing Options in RELAX NG
- An Introduction to RELAX NG
- Path, Predicates, and XQuery
- Using Predicates with XQuery
- Navigating Input Documents Using Paths
- XML Basics
- Introduction to XPath

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials