News:

This week IPhone 15 Pro winner is karn
You can be too a winner! Become the top poster of the week and win valuable prizes.  More details are You are not allowed to view links. Register or Login 

Main Menu

Bind Data Island to HTML Elements

Started by ben2ong2, October 05, 2006, 05:18:59 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ben2ong2

In the next example, we will embed an XML file called "cd_catalog.xml" into an HTML file.
View "cd_catalog.xml".
The HTML file looks like this:
<html><body><xml id="cdcat" src="cd_catalog.xml"></xml><table border="1" datasrc="#cdcat"><tr><td><span datafld="ARTIST"></span></td><td><span datafld="TITLE"></span></td></tr></table></body></html>
Example explained:
The datasrc attribute of the <table> tag binds the HTML table element to the XML data island. The datasrc attribute refers to the id attribute of the data island.
<td> tags cannot be bound to data, so we are using <span> tags. The <span> tag allows the datafld attribute to refer to the XML element to be displayed. In this case, it is datafld="ARTIST" for the <ARTIST> element and datafld="TITLE" for the <TITLE> element in the XML file. As the XML is read, additional rows are created for each <CD> element.
If you are running IE 5.0 or higher, you can try it yourself.
Also try this example, demonstrating <thead>, <tbody>, and <tfoot>.
You are not allowed to view links. Register or Login
You are not allowed to view links. Register or Login