[thelist] Firefox 1.5 and XML
Tom Schmidt
ildenizen at insightbb.com
Sat Feb 18 21:57:40 CST 2006
I have a working site that correctly uses ActiveXObject for Internet Explorer to load/parse an XML file.
So far so good, except that I would like this to work for some people I know who use Mozilla's Firefox browser.
I went over to w3schools and found a nice tutorial on how to "sniff" for support for these particular browsers and then appropriately load the XML file. Below is the snippet from my javascript code:
if (window.ActiveXObject)
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async=false
xmlDoc.load(xmlFile)
}
else if (document.implementation && document.implementation.createDocument)
{
xmlDoc= document.implementation.createDocument("","",null)
xmlDoc.load(xmlFile)
}
else
{
alert('Your browser cannot handle this script')
}
nodes=xmlDoc.documentElement.childNodes
(additional code follows, but should be irrelevant to my problem)
However, while this still works for Internet Explorer, it gives me the following error with Firefox:
Error: xmlDoc.documentElement has no properties
for the following line:
nodes=xmlDoc.documentElement.childNodes
So my question is this - why? Am I still missing some key element here? Or have I abused IE and gotten away with success whilst bungling the script?
Any insights would be much welcome.
Tom
More information about the thelist
mailing list