?
Solved

Classic ASP Google Maps API Reading XML

Posted on 2011-03-01
2
Medium Priority
?
1,467 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 2000 total points
ID: 35015672
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
ID: 35015819
superb answer, given me more than i asked for

cheers
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

719 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