Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. XML With javascript

XML With javascript

Scheduled Pinned Locked Moved Web Development
javascripthtmltoolsxml
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    geeeeeeeetha
    wrote on last edited by
    #1

    hi, While appending a node,whether it will affect original file or not below is my code <html> <body> <script type="text/javascript"> if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET","x.xml",false); xmlhttp.send(); xmlDoc=xmlhttp.responseXML; x=xmlDoc.getElementsByTagName("CD"); for (i=0;i<x[0].childNodes.length;i++) { if (x[0].childNodes[i].nodeType==1) { document.write(x[0].childNodes[i].nodeName); document.write(": "); document.write(x[0].childNodes[i].childNodes[0].nodeValue); document.write("<br />"); } } document.write('<br>-----------------<br>'); for(i=0;i<x.length;i++) { newel=xmlDoc.createElement("PUBLICATION"); newtext=xmlDoc.createTextNode("2007"); newel.appendChild(newtext); x[i].appendChild(newel); } for(i=0;i<x.length;i++) { for (j=0;j<x[i].childNodes.length;j++) { if (x[i].childNodes[j].nodeType==1) { document.write(x[i].childNodes[j].nodeName); document.write(": "); document.write(x[i].childNodes[j].childNodes[0].nodeValue); document.write("<br />"); } } document.write("<br />"); } alert </script> </body> </html> Regards

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups