1
當前我試圖運行一個xPath,然後將每個結果集轉換爲一個DOM對象,以便我可以搜索它的一些東西,但我一直得到一個DOM異常11或未捕獲類型錯誤:非法調用InvalidStateError:XPath結果中的DOM異常11
代碼:
getDataForOutput = function() {
log("Getting Loading Necessary Data from XML ["+settings.rowPath+"]");
if (window.ActiveXObject) {
var nodes=rawXML.selectNodes(path);
alert('Currently not IE compatible');
for (i=0;i<nodes.length;i++) {
//
}
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument) {
var nodes=rawXML.evaluate(settings.rowPath, rawXML, null, XPathResult.ANY_TYPE, null);
var result=nodes.iterateNext();
log(nodes);
while (result) {
//log("result");
for(i in settings.columns) {
if(typeof outputCols[i] == "function") { continue; }
if(typeof outputCols[i] == "undefined") { outputCols[i] = new Array(); }
//log($(result).find(settings.columns[i].tag)[0]);
var data;
//THE LINE BELOW CAUSES THE DOM EXCEPTION 11 TO HAPPEN....
var ele = $(result).find(settings.columns[i].tag)[0];
//THE LINE ABOVE IS EVIL. I EVEN TRIED TO USE:
//var ele = $(jQuery.extend({}, result)).find(settings.columns[i].tag)[0];
//BUT IT GIVES OFF: Uncaught TypeError: Illegal invocation
if(settings.columns[i].nodeName == true) {
data = result.tagName;
} else if(settings.columns[i].nodeValue == true) {
data = result.textContent;
} else if(typeof settings.columns[i].attr != "undefined") {
data = result.getAttribute(settings.columns[i].attr);
}
outputCols[i].push(data);
}
result = nodes.iterateNext(); //Gives Dom Excepti
}
}
log("Data loaded");
},
未捕獲的錯誤:InvalidStateError:DOM異常11
Uncaught Error: InvalidStateError: DOM Exception 11 xmlEditor.js:229
XMLEditor.getDataForOutput xmlEditor.js:229
XMLEditor.outputData xmlEditor.js:70
XMLEditor.loadXML xmlEditor.js:63
XMLEditor.init xmlEditor.js:23
XMLEditor xmlEditor.js:364
(anonymous function) edit_translation.html?page=cerep_assay_translation&sso.token=ffc469425b70b2…en&last_name=Brice&[email protected]&external_id=bricesm1:22
l jquery-2.0.1.min.js:4
c.fireWith jquery-2.0.1.min.js:4
x.extend.ready jquery-2.0.1.min.js:4
S
遺漏的類型錯誤:非法調用
Uncaught TypeError: Illegal invocation jquery-2.0.1.min.js:4
t.nodeType.t.documentElement.i.find.TAG.n.getElementsByTagName.r jquery-2.0.1.min.js:4
St jquery-2.0.1.min.js:4
ot jquery-2.0.1.min.js:4
x.fn.extend.find jquery-2.0.1.min.js:5
XMLEditor.getDataForOutput xmlEditor.js:219
XMLEditor.outputData xmlEditor.js:70
XMLEditor.loadXML xmlEditor.js:63
XMLEditor.init xmlEditor.js:23
XMLEditor xmlEditor.js:366
(anonymous function) edit_translation.html?page=cerep_assay_translation&sso.token=ffc469425b70b2…en:22
l jquery-2.0.1.min.js:4
c.fireWith jquery-2.0.1.min.js:4
x.extend.ready jquery-2.0.1.min.js:4
S