Click here to Skip to main content
15,559,682 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,

I am getting the error as xmlobj.childnode is not a function. can anyone please help me to solve this issue. Here is the code:

C#
loadXML(role)
 for (i=0;i<xmlObj.childNodes.length;i++)

  {
        var innerArray=new Array()
        if (xmlObj.childNodes(i).hasChildNodes())
        {


          menulevel=xmlObj.childNodes(i).childNodes(3).text
          parentid=xmlObj.childNodes(i).childNodes(4).text


          if (menulevel=='0')
          {
           innerArray[0]=xmlObj.childNodes(i).childNodes(1).text
           innerArray[1]=xmlObj.childNodes(i).childNodes(2).text
            innerArray[1]=''
            innerArray[2]=''
            innerArray[3]=''
            innerArray[4]=''
            innerArray[5]=''
            innerArray[6]='0'
            innerArray[7]='0'
          }
          else if (menulevel=='1')
          {
             innerArray[0]='|'+xmlObj.childNodes(i).childNodes(1).text
            innerArray[1]=xmlObj.childNodes(i).childNodes(2).text

            innerArray[2]=''
            innerArray[3]=''
            innerArray[4]=''
            innerArray[5]=''
            innerArray[6]=''
            innerArray[7]=''
          }
          else if (menulevel=='2')
          {
            innerArray[0]='||'+xmlObj.childNodes(i).childNodes(1).text
            innerArray[1]=xmlObj.childNodes(i).childNodes(2).text
            innerArray[2]=''
            innerArray[3]=''
            innerArray[4]=''
            innerArray[5]=''
            innerArray[6]=''
            innerArray[7]=''
          }


          innerArray[8]=''
          innerArray[9]=''
          innerArray[10]=''

        }

        //innerArray[0]="Test"
        //innerArray[1]="Test.aspx"
       outerArray[i]=innerArray
  }

 //var len=outerArray.length
 //outerArray[len]="test"
  return outerArray
}




function loadXML(xmlFile)
{
if (window.ActiveXObject)
{
xmlDoc = new ActiveXObject("Microsoft.XMLHTTP");
        if (xmlDoc) {
        xmlDoc.async="false";
  xmlDoc.onreadystatechange=verify;
  xmlDoc.load(xmlFile);
  xmlObj=xmlDoc.documentElement;

        }

  }
 else if (window.XMLHttpRequest)
  {
  xmlDoc = new XMLHttpRequest();
    xmlDoc.open("GET",xmlFile,false);
   xmlDoc.send(null);
   xmlObj = xmlDoc.responseXML.documentElement;



  }
  }

function verify()
{

  if (xmlDoc.readyState != 4)
  {
    return false;
  }
}


Thanks in advance
Posted
Comments
Sergey Alexandrovich Kryukov 30-Jun-11 18:26pm    
Platform? Language? Tag it!
--SA

Try changing:

xmlObj.childNodes(i)


to

xmlObj.childNodes[i]
 
Share this answer
 
What kind of object is d_iv? Is it a string? Just a quick guess, but try initialising d_iv before giving it values. Something like:

<br />
d_iv.Text = "";<br />
 
Share this answer
 
Comments
Member 7946563 30-Jun-11 4:50am    
Here is the code for your reference:
var d_dvK={d_qie:0,d_ddm:null,d_rsv:null,d_uv:null,d_ce:null,d_iv:null};
var d_lv=0;
while(d_iv.text.charAt(0)=="|")
{
d_lv++;d_iv.text=d_iv.text.substring(1);
}
UJimbo 30-Jun-11 5:45am    
Looking at your code, you still don't define d_iv. I can see d_dvK and d_lv, but d_iv is still not initialised.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900