Hi!
I have two problems width zxml library. The zxml load() doesn't work under Google Chrome. This is the error message:
uncaught exception TypeError: Property '__load__' of object #<a Document> is not a function
I'm not a professional ajax developer, and I don't want to modify Nicholas code. So i send an example, when i get this message:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>XMLHttp használata</title>
<script type="text/javascript" src="zxml.js"></script>
<script>
//ez a metódus inicializálja a környezetet, a body tag kirenderelése közben fut meg
function init() {
//létrehozzuk a DOM dokumentumot
var oXml = zXmlDom.createDocument();
//adjuk hozzá az aszinkron esemény kezelo függvényt
oXml.onreadystatechange = function () {
if ( oXml.readyState == 4 ) {
if ( oXml.parseError.errorCode == 0 ) {
pharsexml(oXml);
} else {
//megnézzük bekerült-e
alert("Hiba a betöltéskor" + oXml.parseError.reason);
}
}
}
//töltsük be az xml-t
oXml.load("users.xml");
}
// csak simán a rootnodeot átadjuk a serilalizernek ezáltal kiverjük a html lapra
function pharsexml(oXmlDom) {
var oRoot = oXmlDom.documentElement;
document.body.innerHTML = new zXMLSerializer().serializeToString( oRoot );
}
</script>
</head>
<body onload="init()">
</body>
</html>
and the users.xml:
Code:
<?xml version="1.0" encoding="utf-8"?>[list]
<li>Adam</li>
<li>Judy</li>
<li>Nicholas</li>
</ul>
It is the simplyest code, when I get this type of error.
The second one is: in opera (9.5 i have), i can't create a new XML DOM object, the message is:
Code:
JavaScript - file://localhost/L:/Szakmai%20Blog/JavaScript/zXML/Examples/Examples/zXmlDOM.htm
Inline script thread
Error:
name: TypeError
message: Statement on line 1: Type mismatch (usually non-object value supplied where object required)
Backtrace:
Line 1 of linked script file://localhost/L:/Szakmai%20Blog/JavaScript/zXML/Examples/Examples/zxml.js
function(){if(zXml.useDom){var oXmlDom=document.implementation.createDocument("","",null);oXmlDom.parseError={valueOf:function(){return this.errorCode;},toString:function(){return this.errorCode.toString()}};oXmlDom.__initError__();oXmlDom.addEventListener("load",function(){this.__checkForErrors__();this.__changeReadyState__(4);},false);return oXmlDom;;}else if(zXml.useActiveX){if(!zXml.DOM_VER){for(var i=0;i<zXml.ARR_DOM_VERS.length;i++){try{new ActiveXObject(zXml.ARR_DOM_VERS[i]);zXml.DOM_VER=zXml.ARR_DOM_VERS[i];break;}catch(oError){;}}}if(zXml.DOM_VER){return new ActiveXObject(zXml.DOM_VER);}else{throw new Error("Could not create XML DOM document.");}}else{throw new Error("Your browser doesn't support an XML DOM document.");}}
Line 3 of inline#1 script in file://localhost/L:/Szakmai%20Blog/JavaScript/zXML/Examples/Examples/zXmlDOM.htm
var oXml = new zXmlDom.createDocument();
stacktrace: n/a; see 'opera:config#UserPrefs|Exceptions Have Stacktrace'
Anyone know solutions?
P.S.: Sorry my terrible english.