Click to See Complete Forum and Search --> : data island problem


coolwave
02-15-2005, 12:11 AM
Hi everyone! I'm still new with xml. I'm trying to display some xml data in a table. The html code is as follows (adapted from w3schools tutorials):

<html>
<body>
<xml id="device_status" src="test.xml"></xml>
<table border="1" datasrc="#device_status">
<thead>
<tr><th>Common Address</th><th>Info Object Address</th><th>Type ID</th><th>Value</th></tr>
</thead>
<tr align="middle">
<td><span datafld="common_addr"></span></td>
<td><span datafld="io_addr"></span></td>
<td><span datafld="tid"></span></td>
<td><span datafld="val"></span></td>
</tr>

</tr>
</table>
</body>
</html>

The test.xml file contents are:
<?xml version="1.0" encoding="ISO-8859-1"?>
<device name="Test Device">
<info_obj>
<common_addr>1</common_addr>
<io_addr>5</io_addr>
<tid>1</tid>
<val>1</val>
<flags>0</flags>
</info_obj>

<info_obj>
<common_addr>1</common_addr>
<io_addr>1</io_addr>
<tid>9</tid>
<val>-0.25</val>
<flags>0</flags>
</info_obj>

<info_obj>
<common_addr>1</common_addr>
<io_addr>13</io_addr>
<tid>3</tid>
<val>0</val>
<flags>0</flags>
</info_obj>
</device>

The problem is this xml data cannot be displayed because the <device> tag has the 'name' attribute. If I remove this attribute, it works fine. How do I rectify this problem? I'm planning to add some more attributes to the <device> tag if I can resolve this problem. FYI, I'm using IE6.

Many thanks!
:confused:

coolwave
02-16-2005, 10:14 PM
I've just learnt that the IE data island technique to display xml in a table is not compatible with other browsers. As an alternative, I could use javascript and XSL as described in http://www.webreference.com/programming/javascript/xml/ by Khalid Ali.

Is there any other technique that I can use without using XSL?

The problem is I need to display the xml 'real-time' data instantly without making reference to internet link (which is slower), since I'm using intranet (private network) and have restricted access to internet.

Any suggestions are welcomed. Thanks!