jammsw
05-12-2005, 11:33 AM
Hi all,
I'm trying to load a XML file as follow:
<html>
<head>
<script type="text/javascript">
var xmlDoc;
function readXML()
{
alert("XML doc read!");
}
function loadXML(url)
{
// code for IE
if (window.ActiveXObject)
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
while(xmlDoc.readyState != 4) {};
xmlDoc.load(url);
readXML();
}
// code for Mozilla, etc.
else if (document.implementation && document.implementation.createDocument)
{
xmlDoc = document.implementation.createDocument("", "doc", null);
xmlDoc.onload = readXML;
xmlDoc.load(url);
}
else
{
alert("Can not handle XML updating!");
}
}
</script>
</head>
<body onload="loadXML('./note.xml')">
<h1>XML TEST</h1>
</body>
</html>
It does work properly for IE but it doesn't for Mozilla (Firefox 1.0.3), it gets the following error:
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMWindowInternal.focus]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://global/content/bindings/tabbrowser.xml :: setFocus :: line 638" data: no]
Does anyone have a clue?
Many thanks in advance for your help!
I'm trying to load a XML file as follow:
<html>
<head>
<script type="text/javascript">
var xmlDoc;
function readXML()
{
alert("XML doc read!");
}
function loadXML(url)
{
// code for IE
if (window.ActiveXObject)
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
while(xmlDoc.readyState != 4) {};
xmlDoc.load(url);
readXML();
}
// code for Mozilla, etc.
else if (document.implementation && document.implementation.createDocument)
{
xmlDoc = document.implementation.createDocument("", "doc", null);
xmlDoc.onload = readXML;
xmlDoc.load(url);
}
else
{
alert("Can not handle XML updating!");
}
}
</script>
</head>
<body onload="loadXML('./note.xml')">
<h1>XML TEST</h1>
</body>
</html>
It does work properly for IE but it doesn't for Mozilla (Firefox 1.0.3), it gets the following error:
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMWindowInternal.focus]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://global/content/bindings/tabbrowser.xml :: setFocus :: line 638" data: no]
Does anyone have a clue?
Many thanks in advance for your help!