Solved

Classic ASP Google Maps API Reading XML

Posted on 2011-03-01
2
1,447 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
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Suggested Solutions

Title # Comments Views Activity
Query not working correctly? (or how i want it to... 6 52
SQL to update characters in table column 6 148
IP API - need data... 4 27
Insert Button on a table 16 38
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 would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

820 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