G
gal.granov
Hi,
i am trying to create an XML wrapper for the IE, Mozilla and Safari.
the interface i want to support is :
myDoc.load("data.xml")
this works fine on IE & NN , but i've read and seen myself, that the
Safari browser does not support the XMLDOC load method.
i am trying to write my own version of this function:
Document.prototype.load= MyLoadFunc;
but safari with it's "wonderful" debug facilities doesnt seem to be
happy with it.
and all i get in the console (debug sent there) is :
TypeError - undefined value.
can i insert this new load func into the Document interface in safari?
where MyLoadFunc is defined as:
function MyLoadFunc(strURL)
{
alert("here");
//set the parseError to 0
this.parseError = 0;
//change the readyState
this.readyState = 1;
//watch for errors
try {
if(this.async == false)
{
//create XMLHttpRequest object
var req = new XMLHttpRequest();
req.open("GET", strURL , false);
req.overrideMimeType("text/xml");
// Execute the request
req.send(null);
//check the returning status
if(req.status>400 || req.status < 200)
{
//set the parseError attribute
this.parseError = -9999999;
//change the readystate
this.readyState = 4;
//call to the onreadystatechange
if (typeof (this.onreadystatechange) == "function")
this.onreadystatechange();
}
else
{
this.loadXML(req.responseText);
//change the readystate
this.readyState = 4;
//call to the onreadystatechange
if (typeof (this.onreadystatechange) == "function")
this.onreadystatechange();
}
}
else
{
//call the original load method
this.OldLoad(strURL);
}
}
catch (objException)
{
//set the parseError attribute
this.parseError = -9999999;
//change the readystate
this.readyState = 4;
//call to the onreadystatechange
if (typeof (this.onreadystatechange) == "function")
this.onreadystatechange();
} // End: try...catch
}
i am trying to create an XML wrapper for the IE, Mozilla and Safari.
the interface i want to support is :
myDoc.load("data.xml")
this works fine on IE & NN , but i've read and seen myself, that the
Safari browser does not support the XMLDOC load method.
i am trying to write my own version of this function:
Document.prototype.load= MyLoadFunc;
but safari with it's "wonderful" debug facilities doesnt seem to be
happy with it.
and all i get in the console (debug sent there) is :
TypeError - undefined value.
can i insert this new load func into the Document interface in safari?
where MyLoadFunc is defined as:
function MyLoadFunc(strURL)
{
alert("here");
//set the parseError to 0
this.parseError = 0;
//change the readyState
this.readyState = 1;
//watch for errors
try {
if(this.async == false)
{
//create XMLHttpRequest object
var req = new XMLHttpRequest();
req.open("GET", strURL , false);
req.overrideMimeType("text/xml");
// Execute the request
req.send(null);
//check the returning status
if(req.status>400 || req.status < 200)
{
//set the parseError attribute
this.parseError = -9999999;
//change the readystate
this.readyState = 4;
//call to the onreadystatechange
if (typeof (this.onreadystatechange) == "function")
this.onreadystatechange();
}
else
{
this.loadXML(req.responseText);
//change the readystate
this.readyState = 4;
//call to the onreadystatechange
if (typeof (this.onreadystatechange) == "function")
this.onreadystatechange();
}
}
else
{
//call the original load method
this.OldLoad(strURL);
}
}
catch (objException)
{
//set the parseError attribute
this.parseError = -9999999;
//change the readystate
this.readyState = 4;
//call to the onreadystatechange
if (typeof (this.onreadystatechange) == "function")
this.onreadystatechange();
} // End: try...catch
}