Siblja
Siblja

Reputation: 859

Accesing XML values with classic asp through xmlhttp

I have, maybe trivial problem, but i could not find any answer on Google due to lack of documentation. I`m sending request from my domain to another, and aiming for web service that returns XML. I do this through this piece of code:

url = "some url aiming at web service"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") 
    xmlhttp.open "GET", url, false 
    xmlhttp.send "" 
    xmlString = xmlhttp.responseText
set xmlhttp = nothing 

When i try to print xmlString it returns complete page. How can i access specific nodes and values?

XML is similar to this:

<grandpa>
   <father>value</father>
   <son>value</son>
</grandpa>

Upvotes: 0

Views: 4863

Answers (1)

Samuel Zhang
Samuel Zhang

Reputation: 1280

Try to use responseXML which is a full featured XML DOM where you can leverage selectSingleNode with XPath expression to get the node, e.g

xmlhttp.responseXML.selectSingleNode("//grandpa/father");

Upvotes: 2

Related Questions