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

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
TABLE OF CONTENTS:
  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
SEARCH DEVARTICLES

The Why and How of XML Data Islands - Showing the complete data
(Page 3 of 4 )

You may complete this picture by adding the other two DATAFLDs, namely student id and legacySkill, and your display would be as shown in the next picture. Some additional formatting has been added to make the display a little more jazzy. You may also notice that the data may be accessed in any order and need not follow the same one as in the original XML. If you choose not to show this data, you may leave them out as in Basic.htm.

Referencing an XML file on a web server

In Simple.htm the XML file was hard coded into the page. Instead of this you may also reference a file on the web server by referencing its "src" property as shown in the next snippet.

<xml DATASRC="WebStudents" src="http://localhost/webstudents.xml" ></xml>

The source of the htm file, Basic2.htm with XML being referenced to a file saved on the web server, is shown in the next paragraph.

Basic 2.htm
<HTML> 
<HEAD> 
<TITLE> </TITLE> 
</HEAD> 
<BODY>
<h3>Html file with embedded XML</h3> <P>Here begins the XML Data Island</P> <xml id="WebStudents" src="http://localhost/webstudents.xml"></xml>
 <P>Here ends the XML Data Island</P>
 <table DATASRC="#WebStudents" border="1" bgcolor="powderblue">
<tr>
<td><span DATAFLD="name"></td>
<td><span DATAFLD="id"></td>
<td><span DATAFLD="legacySkill"</td>
</tr>
</table>
 </BODY> 
</HTML> 


blog comments powered by Disqus
XML ARTICLES

- 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 
Support 

Developer Shed Affiliates

 




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