Note that there are some explanatory texts on larger screens.

plurals
  1. POIE9 Javascript XMLHttpRequest responseXML childNodes Invalid number of parameters
    text
    copied!<p>I am writing a page that uses javascript to load an xml file from the server, and then I parse it. My code runs correctly in Firefox, Chrome, and IE10, but in IE9 the childNodes array of the responseXML object has only 1 item that says "Invalid number of parameters". I know the xml loads correctly because the firstChild property has the correct name and value, and its firstChild property does also, etc. </p> <p>I could rewrite my parsing code to work with this, but I dont really want to do that for a number of reasons. </p> <p>Does anyone have any ideas what my problem is here? I also noticed that the dataType and doctype properties of the responseXML object are null. </p> <p>I checked the http header the server is sending back when the xml file is requested, and it has Content-Type: text/xml. </p> <p>This is my code that is causing the problem,</p> <pre><code>var xmlReq = new XMLHttpRequest(); xmlReq.addEventListener("load", onXmlReqComplete, false); xmlReq.addEventListener("error", onXmlReqError, false); xmlReq.addEventListener("abort", onXmlReqAbort, false); xmlReq.open("get", "tree.xml", true); xmlReq.send(); function onXmlReqComplete(e){ var xmlResp = this.responseXML; //this is the line that causes the error, //SCRIPT5007: Unable to get property 'childNodes' of undefined or null reference var items = xmlResp.childNodes[0].childNodes[1].childNodes; for(var i = 0; i &lt; items.length; i++){ if(items[i].nodeName == "#text"){ continue; } treeData.push(items[i]); } layoutDisplay(); } </code></pre> <p>Any help is appreciated, thank you</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload