1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

XML Parsing Problem

Discussion in 'C#' started by Jimbalaya, Feb 24, 2006.

  1. #1
    Hi,

    I'm having trouble with parsing an XML file from Yahoo's Geocoder.

    I'm getting an (0x800A01A8) Object required error on the line following line: Response.Write "Latitude" & xmlDoc.selectSingleNode("Latitude").Text
    SEMrush
    If I coment that our I get the same error on the next line.

    Here is my code and the xml file I should be returning follows.

    <%
                            
    xmlURL = "http://api.local.yahoo.com/MapsService/V1/geocode?appid=SmartStart&street=3821%20Plantation%20Ln%20&zip=75035"
                            
    '// Create the XMLHTTP object
    Set xmlHTTP = Server.CreateObject("MSXML2.XMLHTTP")
                            
    '// Fire off the request!
    xmlHTTP.Open "GET", xmlURL
    xmlHTTP.Send 
    
    '// Load the XML parser
    Set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
    xmlDoc.Async = False
    xmlDoc.loadXML (xmlHTTP.ResponseXML.xml)
                                
    '// Set the Result node
    Set arrResult = xmlDoc.selectSingleNode("//ResultSet/Result")
                                
    '// Show Latitude and Longitude
    Response.Write "Latitude" & arrResult.selectSingleNode("Latitude").Text
    Response.Write "Longitude" & ArrResult.selectSingleNode("Longitude").Text
                                
    '// Unload XML parser
    Set xmlDoc = Nothing
    
    '// Destroy the object
    Set xmlHTTP = Nothing
    
    %>
    
    
    Code (markup):
    Yahoo XML
    
    <?xml version="1.0" encoding="UTF-8" ?> 
    - <ResultSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:yahoo:maps" xsi:schemaLocation="urn:yahoo:maps http://api.local.yahoo.com/MapsService/V1/GeocodeResponse.xsd">
    - <Result precision="address">
      <Latitude>33.109863</Latitude> 
      <Longitude>-96.781642</Longitude> 
      <Address>3821 PLANTATION LN</Address> 
      <City>FRISCO</City> 
      <State>TX</State> 
      <Zip>75035-8587</Zip> 
      <Country>US</Country> 
      </Result>
      </ResultSet>
    - <!--  ws01.search.re2.yahoo.com compressed/chunked Fri Feb 24 06:41:55 PST 2006 --> 
    Code (markup):
    Thank you,
    Jim
     
    Jimbalaya, Feb 24, 2006 IP
    SEMrush