Solved

Classic ASP Google Maps API Reading XML

Posted on 2011-03-01
2
1,431 Views
Last Modified: 2012-05-11
I wanted to use the following URL to get the XML from Google
http://maps.google.co.uk/maps/geo?q=bl17le&output=xml

It returns XML, is there an easy way to use this return in ASP
is it wasy to pull out the data into variables.

thanks
0
Comment
Question by:Nick_SD
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
Comment Utility
It's fairly straightforward. You just need to load the XML into an XML Document object and use XPath to retrieve the nodes you are interested in. The only small caveat is that you need to handle the namespace that the Xml uses.

Here's a quick sample that retrieves the value of the "address" node returned by the URL you posted:
<%
    Set http = Server.CreateObject("MSXML2.ServerXMLHTTP.6.0")
    http.open "GET", "http://maps.google.co.uk/maps/geo?q=bl17le&output=xml", false
    http.send

    Set doc = Server.CreateObject("MSXML2.DOMDocument.6.0")
    doc.loadXml http.responseText

    If doc.parseError.errorCode <> 0 Then
       Response.Write doc.parseError.reason
       Response.End
    End If
    

    doc.setProperty "SelectionNamespaces", "xmlns:x='http://earth.google.com/kml/2.0'"

    Set node = doc.selectSingleNode("/x:kml/x:Response/x:Placemark/x:address")
    Response.Write "Address: " & node.Text
%>

Open in new window

0
 

Author Closing Comment

by:Nick_SD
Comment Utility
superb answer, given me more than i asked for

cheers
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Upload a file using ASP Classic 20 49
two-way Authentication ASP 3 70
Grab data from remote page 10 57
How to solve this equation 3 47
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now