advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
Partners & Affiliates
advertisement
advertisement
Tip of the Day
Average Rating: 4/5 | Rate this item | 6 users have rated this item.
Expertise: Beginner
Language: Web
June 15, 2000
Displaying an XML Data Island in an HTML Table

The <XML> tag can be used to create an XML data island. XML data islands are XML- data referenced or included in an HTML page. The XML data can be part of the HTML document, or it can stay in an external data file.

The ID attribute given with the <XML> tag is used to reference the data island. You can format and display the data in the XML data island by using HTML tags that can accept data source tags. Basically, the whole idea is to bind the HTML to the data.

Here is an example that displays the XML items tagged with <Employee>.

 
<HTML>
<HEAD>
<TITLE>XML Data Island Demo</TITLE>
</HEAD>
<BODY>
<XML ID="Employees">
<?xml version="1.0" ?>
<Employees>
	<Employee Code="1234" Name="Deepak Pant"/>
	<Employee Code="1234" Name="Meenakshi Pant"/>
	<Employee Code="1234" Name="Pragati Pant"/>
</Employees>
</XML>
<TABLE DATASRC="#EMPLOYEES">
<TR>
<TD><DIV DATAFLD="Code"></DIV></TD>
<TD><DIV DATAFLD="Name"></DIV></TD>
</TR>
</TABLE>
</BODY>
</HTML>

The <TABLE> tag uses the DATASRC attribute to reference the in-line XML. The DATASRC refers to the ID attribute used to identify the XML preceded by a pound sign (#).

Since the TD element cannot be bound to data, we are using the DIV element. The DIV element allows the DATAFLD attribute to refer to the XML element that is placed in the cell of the table. In this case, it's DATAFLD="Code" for the "Code" attribute of the <Employee> XML element. As the XML is read, additional rows are created for each element tagged with the <Employee> tag.

Deepak Pant
If you have a hot tip and we publish it, we'll pay you. However, due to accounting overhead we no longer pay $10 for a single tip submission. You must accumulate 10 acceptable tips to receive payment. Be sure to include a clear explanation of what the technique does and why it's useful. If it includes code, limit it to 20 lines if possible. Submit your tip here.
Please rate this item (5=best)
 1  2  3  4  5
advertisement
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs