Ryan's District Boards

Computer, programming, and webmaster help , support , tips and tricks => Tutorials Zone! => Internet webmaster computer programming technology tips and tricks => XML Tutorials => Topic started by: ben2ong2 on October 06, 2006, 04:10:06 PM

Title: Bind the Data Island to <span> or <div> Elements
Post by: ben2ong2 on October 06, 2006, 04:10:06 PM
<span> or <div> elements can be used to display XML data.
You don't have to use the HTML table element to display XML data. Data from a Data Island can be displayed anywhere on an HTML page.
All you have to do is to add some <span> or <div> elements to your page. Use the datasrc attribute to bind the elements to the Data Island, and the datafld attribute to bind each element to an XML element, like this:

Title:<span datasrc="#xmldso" datafld="TITLE"></span>
Artist:<span datasrc="#xmldso" datafld="ARTIST"></span>
Year:<span datasrc="#xmldso" datafld="YEAR"></span>
or like this:

Title:<div datasrc="#xmldso" datafld="TITLE"></div>
Artist:<div datasrc="#xmldso" datafld="ARTIST"></div>
Year:<div datasrc="#xmldso" datafld="YEAR"></div>
If you have IE 5.0 or higher: See how the XML data is displayed inside the HTML elements.
Note that if you use an HTML <div> element, the data will be displayed on a new line.
With the examples above, you will only see one line of your XML data. To navigate to the next line of data, you have to add some scripting to your code.