title: Uncaught TypeError: Cannot call method 'hasChildNodes' of undefined
body: <p>I am trying to read a XML using ajax request in jquery. Below is the code,it's working fine in IE but when I run this on Chrome i am facing this error</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot call method 'hasChildNodes' of undefined</p>
  </blockquote>
  
  <pre><code>$.ajax({
  
      type: "GET",
      url: "tree1.xml",
      dataType:"xml",
      success: function(xml){
          root=xml.documentElement;
          childs=root.childNodes;
          for(var i=0;i&lt;childs.length;i++){
              z=childs[i].childNodes;
              adChilds(z,childs,oNode);
  
  
              function adChilds(a,b,c){
                  if(a[i].hasChildNodes()){
                      adNode(b[i].nodeName,c);
                      var oNode_ch=oNode1;
                      for(var j=0;j&lt;a.length;j++){
                          child1=a[j].childNodes;
                          adNode(child1[0].nodeValue,oNode_ch);
                      }
                  }
                  else{adNode(a[0].nodeValue,oNode);}
              }
          }
  </code></pre>
  
  <p>error is pointing at this line.</p>
  
  <p><strong>if(a[i].hasChildNodes()){</strong></p>
  
  <p>Can anyone suggest me where am I going wrong.</p>
  
  <p>Thanks in advance!</p>