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">
<tr>
<td><span DATAFLD="name"></span></td>
</tr>
</table>
and call the new file Basic.htm, whose source is shown in the next paragraph:
Basic.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">
<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.

Next: Showing the complete data >>
More XML Articles
More By Jayaram Krishnaswamy