Solved

Classic ASP Google Maps API Reading XML

Posted on 2011-03-01
2
1,457 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 500 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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

636 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