PDA

View Full Version : Reading External XML values


tannyboy
10-04-2005, 01:18 AM
Hi all,

Im tryign to get this XML file to display into a HTML doco; i've got it to work nicely in ie. through the <xml... tag> & datasrc elements. When i got home to check it (mac user) low and behold it didn't work. Then again this morning i checked it in Firefox (PC) and it didn't work.

Could some one point me in the right direction.

i got rid oof some of the code -just to make it a bit more readble.

----

<script type="text/javascript">
function testclick(field)
{
var row=field.rowIndex
xmldso_list.recordset.absoluteposition=row
td_course.innerHTML=xmldso_list.recordset("TITLE")
td_code.innerHTML=xmldso_list.recordset("CODE")
td_pre.innerHTML=xmldso_list.recordset("PREREQS")
td_job.innerHTML=xmldso_list.recordset("JOB")
td_info.innerHTML= '<a href="'+xmldso_list.recordset("INFO")+'" target="_blank">Click Here</a>'
}
</script>


<xml id="xmldso_list" src="arts.xml"></xml>
<table width="330px" datasrc="#xmldso_list" border="0">
<thead>
<tr align="left">
<th colspan="2" height="1"></th>
</tr>
</thead>
<tr align="left" onclick="testclick(this)">
<td width="14"><img src="/images/arrow4.gif" width="14" height="7"></td>
<td><div datafld="TITLE" /></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td>
<table border="0" width="330px" height="241">
<tr style="vertical-align:top;">
<th width="30%"><div align="left">Course Name: </div></th>
<td id="td_course">Please select a course from above</td>
</tr>


-----

Cheers
TB

KC-Luck
10-04-2005, 05:55 PM
the xml element is propietary to IE, and not a standard.
here's some reading to get you started on supporting it.
http://www.mozilla.org/xmlextras/xmldataislands/