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. Load XML File from Client Machine using Javascript

Load XML File from Client Machine using Javascript

Scheduled Pinned Locked Moved ASP.NET
questionjavascriptxml
5 Posts 3 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.
  • K Offline
    K Offline
    Krishnraj
    wrote on last edited by
    #1

    Hi all, I Develop one application in which i want to load XML file from client machine using javascript and process its nodes. How can i load XML file which is stored at client machine into my application??? :doh: Thanks in advance...

    Krishnraj

    M A 2 Replies Last reply
    0
    • K Krishnraj

      Hi all, I Develop one application in which i want to load XML file from client machine using javascript and process its nodes. How can i load XML file which is stored at client machine into my application??? :doh: Thanks in advance...

      Krishnraj

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      Javascript does not have the power to to access the file system. you will need to use ActiveX which will read the file for you.

      Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      K 1 Reply Last reply
      0
      • M Manas Bhardwaj

        Javascript does not have the power to to access the file system. you will need to use ActiveX which will read the file for you.

        Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

        K Offline
        K Offline
        Krishnraj
        wrote on last edited by
        #3

        Hi manas, First-of-all thanks for reply... Do u have any idea regarding the kind of ActiveX available which read the xml file from client machine as i have a short deadline?? Thanks Again buddy.. :)

        Krishnraj

        M 1 Reply Last reply
        0
        • K Krishnraj

          Hi manas, First-of-all thanks for reply... Do u have any idea regarding the kind of ActiveX available which read the xml file from client machine as i have a short deadline?? Thanks Again buddy.. :)

          Krishnraj

          M Offline
          M Offline
          Manas Bhardwaj
          wrote on last edited by
          #4

          Krishnraj wrote:

          Do u have any idea regarding the kind of ActiveX available

          var xmlDocument = new ActiveXObject("Msxml2.DOMDocument.3.0");
          xmlDocument.load(src);

          Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

          1 Reply Last reply
          0
          • K Krishnraj

            Hi all, I Develop one application in which i want to load XML file from client machine using javascript and process its nodes. How can i load XML file which is stored at client machine into my application??? :doh: Thanks in advance...

            Krishnraj

            A Offline
            A Offline
            Abhishek Sur
            wrote on last edited by
            #5

            pass the xml string to this function and get the Document object. After that you can call GetElementsByTagName to get nodes

            function(text) getXMLDocument {
            try {
            xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
            xmlDoc.async = "false";
            xmlDoc.loadXML(text);
            }
            catch (e) {
            try {
            var parser = new DOMParser();
            xmlDoc = parser.parseFromString(text, "text/xml");
            }
            catch (e) {
            alert(e.message);
            return;
            }
            }
            return xmlDoc;
            }

            var doc = getXMLDocument('xxgg');
            var elements = doc.getElementsByTagName('item');

            I think this is what you needed. :-D

            Abhishek Sur


            My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

            **Don't forget to click "Good Answer" if you like to.

            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