Solved

Classic ASP Google Maps API Reading XML

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

867 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

16 Experts available now in Live!

Get 1:1 Help Now