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. how to get node value from var containing xml file data using java script

how to get node value from var containing xml file data using java script

Scheduled Pinned Locked Moved ASP.NET
javajavascripttoolsxmltutorial
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.
  • T Offline
    T Offline
    trilokharry
    wrote on last edited by
    #1

    Hi how can I get node value from var containing xml file data using javascript. thanks.

    You get the best out of others when you give the best of yourself.

    M 1 Reply Last reply
    0
    • T trilokharry

      Hi how can I get node value from var containing xml file data using javascript. thanks.

      You get the best out of others when you give the best of yourself.

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      Are you looking for something like this? http://www.w3schools.com/Xml/xml_parser.asp[^]

      www.MishaInTheCloud.com

      T 1 Reply Last reply
      0
      • M Mike Ellison

        Are you looking for something like this? http://www.w3schools.com/Xml/xml_parser.asp[^]

        www.MishaInTheCloud.com

        T Offline
        T Offline
        trilokharry
        wrote on last edited by
        #3

        Hello in below code after getting xml data in variable now I want to get node value of first child. I have tried but not able to access node value but when I'm showing that var in alert message it's showing data in xml format. thanks see below code: <script language="javascript" type="text/javascript"> <!-- //Browser Support Code function ajaxFunction(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ document.myForm.time.value = ajaxRequest.responseText; //alert(ajaxRequest.responseText) ajaxResponse = ajaxRequest.responseText; //ajaxResponse contains xml data now I want get node value of first child } function verify() { // 0 Object is not initialized // 1 Loading object is loading data // 2 Loaded object has loaded data // 3 Data from object can be worked with // 4 Object completely initialized if (xmlDoc.readyState != 4) { return false; } } //--> </script>

        You get the best out of others when you give the best of yourself.

        G 1 Reply Last reply
        0
        • T trilokharry

          Hello in below code after getting xml data in variable now I want to get node value of first child. I have tried but not able to access node value but when I'm showing that var in alert message it's showing data in xml format. thanks see below code: <script language="javascript" type="text/javascript"> <!-- //Browser Support Code function ajaxFunction(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ document.myForm.time.value = ajaxRequest.responseText; //alert(ajaxRequest.responseText) ajaxResponse = ajaxRequest.responseText; //ajaxResponse contains xml data now I want get node value of first child } function verify() { // 0 Object is not initialized // 1 Loading object is loading data // 2 Loaded object has loaded data // 3 Data from object can be worked with // 4 Object completely initialized if (xmlDoc.readyState != 4) { return false; } } //--> </script>

          You get the best out of others when you give the best of yourself.

          G Offline
          G Offline
          gottimukkala
          wrote on last edited by
          #4

          Try with ajaxResponse.firstChild to get the first child of ajaxResponse node.

          -- http://ashakthi.blogspot.com http://kids-articles.blogspot.com

          T 1 Reply Last reply
          0
          • G gottimukkala

            Try with ajaxResponse.firstChild to get the first child of ajaxResponse node.

            -- http://ashakthi.blogspot.com http://kids-articles.blogspot.com

            T Offline
            T Offline
            trilokharry
            wrote on last edited by
            #5

            not working it's showing null value in alert message. thanks

            You get the best out of others when you give the best of yourself.

            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