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. ASP.NET
  4. Add/update nodes in xml file using javascript

Add/update nodes in xml file using javascript

Scheduled Pinned Locked Moved ASP.NET
javascriptxmlquestionannouncement
6 Posts 2 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.
  • D Offline
    D Offline
    DineshSharmain
    wrote on last edited by
    #1

    Hi I want to Add/update nodes in xml file using javascript..... is it possible? if yes then HOW.... Thanks

    Dinesh Sharma

    M 1 Reply Last reply
    0
    • D DineshSharmain

      Hi I want to Add/update nodes in xml file using javascript..... is it possible? if yes then HOW.... Thanks

      Dinesh Sharma

      M Offline
      M Offline
      m khansari
      wrote on last edited by
      #2

      hi yes it's possible. i tell you that if you use asp.net it's better to use it's features for manipulating XML docs. using this function you can load a xml file in your HTML document. //javascript function code for loading XML doc function loadXMLDoc(dname) { var xmlDoc // code for IE if (window.ActiveXObject) { xmlDoc=new ActiveXObject("Microsoft.XMLDOM") } // code for Mozilla, Firefox, Opera, etc. else if (document.implementation && document.implementation.createDocument) { xmlDoc=document.implementation.createDocument("","",null) } else { alert('Your browser cannot handle this script'+'
      Reason: Your browser does not support XML document') } xmlDoc.async=false try { xmlDoc.load(dname) } catch(err) { alert("When loading XML document one error occured\nError: "+err) return(null) } return(xmlDoc) } after loading XML doc you can use XML DOM for manipulating. for more information about XML DOM visit http://www.w3schools.com/dom/default.asp bye. Mohammad Khansari

      D 1 Reply Last reply
      0
      • M m khansari

        hi yes it's possible. i tell you that if you use asp.net it's better to use it's features for manipulating XML docs. using this function you can load a xml file in your HTML document. //javascript function code for loading XML doc function loadXMLDoc(dname) { var xmlDoc // code for IE if (window.ActiveXObject) { xmlDoc=new ActiveXObject("Microsoft.XMLDOM") } // code for Mozilla, Firefox, Opera, etc. else if (document.implementation && document.implementation.createDocument) { xmlDoc=document.implementation.createDocument("","",null) } else { alert('Your browser cannot handle this script'+'
        Reason: Your browser does not support XML document') } xmlDoc.async=false try { xmlDoc.load(dname) } catch(err) { alert("When loading XML document one error occured\nError: "+err) return(null) } return(xmlDoc) } after loading XML doc you can use XML DOM for manipulating. for more information about XML DOM visit http://www.w3schools.com/dom/default.asp bye. Mohammad Khansari

        D Offline
        D Offline
        DineshSharmain
        wrote on last edited by
        #3

        Thanks for your reply I have already implemented the script and I am getting the updated string....but its not updating my physical file "XMLFile.xml". How can I update the file..... Thanks

        Dinesh Sharma

        M 1 Reply Last reply
        0
        • D DineshSharmain

          Thanks for your reply I have already implemented the script and I am getting the updated string....but its not updating my physical file "XMLFile.xml". How can I update the file..... Thanks

          Dinesh Sharma

          M Offline
          M Offline
          m khansari
          wrote on last edited by
          #4

          hi using javascript code you can manipulate XML doc in client computer not server computer if you want to manipulate XML doc on server computer you must use a server side programing javascript is a client-side programing language. do you use ASP.NET? I don't know where is your XML doc? in Client computer or server computer. plz answer this question.

          Mohammad Khansari

          D 1 Reply Last reply
          0
          • M m khansari

            hi using javascript code you can manipulate XML doc in client computer not server computer if you want to manipulate XML doc on server computer you must use a server side programing javascript is a client-side programing language. do you use ASP.NET? I don't know where is your XML doc? in Client computer or server computer. plz answer this question.

            Mohammad Khansari

            D Offline
            D Offline
            DineshSharmain
            wrote on last edited by
            #5

            my file is on server and m using asp.net 2.0... actually if i am using serverside code then page reloads so i am trying to use [Ajax.AjaxMethod()] but it doesn't work properly..... is there any other way...like ajax or.....

            Dinesh Sharma

            M 1 Reply Last reply
            0
            • D DineshSharmain

              my file is on server and m using asp.net 2.0... actually if i am using serverside code then page reloads so i am trying to use [Ajax.AjaxMethod()] but it doesn't work properly..... is there any other way...like ajax or.....

              Dinesh Sharma

              M Offline
              M Offline
              m khansari
              wrote on last edited by
              #6

              hi If you explain more then I can help you. do you want to change a xml doc exists on server through client? bye.

              Mohammad Khansari

              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