Jump to content

harry0812

Members
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

1 Neutral

About harry0812

  • Rank
    Newbie
  1. Please help me convert the below small code from vbscript to javascript, set xmlDoc=CreateObject("Microsoft.XMLDOM")xmlDoc.async="false"xmlDoc.load("nba.xml")for each x in xmlDoc.documentElement.childNodes;document.write("<b>" + x.nodename + "</b>");document.write(": ");document.write(x.text);document.write("<br>");next Thanks in advance.
  2. Please help me convert the below vbscript to javascript : set xmlDoc=CreateObject("Microsoft.XMLDOM")xmlDoc.async="false"xmlDoc.load("nba.xml")for each x in xmlDoc.documentElement.childNodes;document.write("<b>" + x.nodename + "</b>");document.write(": ");document.write(x.text);document.write("<br>");next Thanks in advance
  3. I did find a way out . Can someone help me convert the below small script from vbscript to javascript. set xmlDoc=CreateObject("Microsoft.XMLDOM")xmlDoc.async="false"xmlDoc.load("nba.xml")for each x in xmlDoc.documentElement.childNodes; document.write("<b>" + x.nodename + "</b>"); document.write(": "); document.write(x.text); document.write("<br>");next
  4. I did try that. But its not able to parse a multilevel XML.eg :<a><b></b> <c> <d></d> <e></e> </c></a>
  5. Can someome please give me a dummy script that reads a data from a multilvel XML and parses it using Javascript and displays it in the html page. The catch is :- You are not allowed to use getElementByName and getElementById, etc... Only nodeType, childnode and other such attribuit is allowed.Please assist me here.
  6. Yes, i am using childnodes[0], however for some reason its not able to traverse inside the company tag. Dont know where am I making the mistake . This is the scriptfunction get_firstchild(n){x=n.firstChild;while (x.nodeType!=1) { x=x.nextSibling; }return x;}x=xmlDoc.documentElement;firstNode=get_firstchild(x);document.write(firstNode.childNodes.length);for (i=0;i<firstNode.childNodes.length;i++){if (firstNode.childNodes.nodeType==1) { //Process only element nodes document.write(firstNode.childNodes.nodeName); document.write(" = "); document.write(firstNode.childNodes.childNodes[0].nodeValue); document.write("<br />"); }}
  7. Hi,I have a xml file in the following format<employee><name>a1</name><age>22</age> <company> <name>company1</name> <address>address1</address> </company><tenure>3yrs</tenure></employee> I want to parse the xml file in javscript without using any getelementById or getelementByName. I was able to parse the xml using nodeValue, nodeType, however I am not able to parse inside the "company" tag (as company is a second level node). I am just able to extractname=a1age=22company=tenure=3yrs. Can someone please assist me with the script to even parse inside company tag using nodeType and nodeValue.Thanks in Advance !!
×
×
  • Create New...