Parsen Google Geocoding XML in klassischen ASP

stimmen
1

Mit http://maps.googleapis.com/maps/api/geocode/xml?address=5555%20La%20Cienaga%20Blvd%20Los%20Angeles,%20CA&sensor=false

Ich versuche, XML in klassischen ASP zu analysieren.

Ich verschiedene Beispiele versucht, nehme an, sie zu arbeiten, aber ich kann nicht

Kann mir jemand eine Hand geben? Zum Beispiel, wenn ich will , Wert erhalten für „ lat “ und „ formatted_address “ wie kann ich es tun?

Im Folgenden finden Sie die XML, die ich von der Verbindung erhalten oben

<GeocodeResponse>
<status>OK</status>
<result>
<type>street_address</type>
<formatted_address>5555 La Cienega, Los Angeles, CA 90056, USA</formatted_address>
<address_component>
<long_name>5555</long_name>
<short_name>5555</short_name>
<type>street_number</type>
</address_component>
<address_component>
<long_name>La Cienega</long_name>
<short_name>La Cienega</short_name>
<type>route</type>
</address_component>
<address_component>
<long_name>Los Angeles</long_name>
<short_name>Los Angeles</short_name>
<type>locality</type>
<type>political</type>
</address_component>
<address_component>
<long_name>Los Angeles</long_name>
<short_name>Los Angeles</short_name>
<type>administrative_area_level_2</type>
<type>political</type>
</address_component>
<address_component>
<long_name>California</long_name>
<short_name>CA</short_name>
<type>administrative_area_level_1</type>
<type>political</type>
</address_component>
<address_component>
<long_name>United States</long_name>
<short_name>US</short_name>
<type>country</type>
<type>political</type>
</address_component>
<address_component>
<long_name>90056</long_name>
<short_name>90056</short_name>
<type>postal_code</type>
</address_component>
<geometry>
<location>
<lat>33.9978986</lat>
<lng>-118.3696586</lng>
</location>
<location_type>RANGE_INTERPOLATED</location_type>
<viewport>
<southwest>
<lat>33.9965523</lat>
<lng>-118.3709990</lng>
</southwest>
<northeast>
<lat>33.9992503</lat>
<lng>-118.3683010</lng>
</northeast>
</viewport>
<bounds>
<southwest>
<lat>33.9978986</lat>
<lng>-118.3696586</lng>
</southwest>
<northeast>
<lat>33.9979040</lat>
<lng>-118.3696414</lng>
</northeast>
</bounds>
</geometry>
<partial_match>true</partial_match>
</result>
</GeocodeResponse>
Veröffentlicht am 20/02/2013 um 07:25
quelle vom benutzer
In anderen Sprachen...                            


1 antworten

stimmen
1

Initiieren Sie das XML-Dokument in klassischen ASP, sobald Sie das getan versuchen, die mithilfe von XPath

Set docXML = CreateObject( "Microsoft.XMLDOM" ) 
docXML.async = False 
docXML.loadXML( myXMLText )

für das Erhalten des lat

docXML.documentElement.selectSingleNode( "/GeocodeResponse/result/geometry/location/lat" )

und

docXML.documentElement.selectSingleNode( "/GeocodeResponse/result/formatted_address" )

für die formatierte Adresse zu bekommen.

Beantwortet am 20/02/2013 um 10:25
quelle vom benutzer

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more