View Full Version : Netscape and reading external XML values

12-04-2002, 01:17 AM
I'm trying to get this nice little script to work in Netscape 6+ and I think it's the script that's giving me fits...

What it does in IE:
<xml> includer loads information from an external XML document into the page so that all the values are present.
The script assigns ids to the information and loads that information into a formatted output table on the page on demand (the command being the user clicks on the cell of a "click-sensitive" table that contains the option they wish to choose.)

Like so ...

<script type="text/javascript">
function testclick(field)
var row=field.rowIndex

The script later gets called here ... (in a table | formatting truncated here ... original contains cells for all resulting values)

<td bgcolor="whitesmoke" id="td_address">Address:</td>
<tr align="left">
<td bgcolor="whitesmoke" id="td_citystate">City/State:</td>
<tr align="left">
<td bgcolor="whitesmoke" id="td_phone">Phone:</td>

Problem is that Netscape (*hisses heard in the background) won't parse the information the way the script is organized now. I am a designer first and foremost and though I pride myself on knowing a little bit more than average about coding/scripting...this one is admittedly beyond me. If this script is workable for NS that would be great. If it just can't be done, I'd be interested in alternatives if any are available. Any help here would be greatly appreciated.

EDIT: Since I'm not sure I'm explaining this correctly, here's an example page... obviously you're only going to see results in IE 4+.


Thanks in advance, all.


12-04-2002, 01:51 AM
Unfortunately, you are using a proprietary element of Internet Explorer with this:
<xml id="xmldso_list" src="firm_listing.xml"></xml>

This is not the correct way to import nor use XML data.

The correct way is through pure scripting:

var doc = document.implementation.createDocument('', '', null);
doc.addEventListener('load', function(event) {
// use DOM to parse doc, and insert nodes into the curent document
}, false);

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum