Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在经典ASP中解析Google地理编码XML_Xml_Asp Classic_Google Geocoder - Fatal编程技术网

在经典ASP中解析Google地理编码XML

在经典ASP中解析Google地理编码XML,xml,asp-classic,google-geocoder,Xml,Asp Classic,Google Geocoder,使用 我正在尝试用经典的ASP解析XML 我试过不同的例子,它们本应该有效,但我不行 谁能帮我一把吗? 例如,如果我想获取“lat”和“格式化的\u地址”的值,我该怎么做 下面是我从上面的链接获得的XML <GeocodeResponse> <status>OK</status> <result> <type>street_address</type> <formatted_address>5555 La Cie

使用

我正在尝试用经典的ASP解析XML

我试过不同的例子,它们本应该有效,但我不行

谁能帮我一把吗? 例如,如果我想获取“lat”和“格式化的\u地址”的值,我该怎么做

下面是我从上面的链接获得的XML

<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>

好啊
街道地址
美国加利福尼亚州洛杉矶拉西内加5555号,邮编90056
5555
5555
街道号码
拉西内加
拉西内加
路线
洛杉矶
洛杉矶
地点
政治的
洛杉矶
洛杉矶
行政区二级
政治的
加利福尼亚
加利福尼亚州
行政区一级
政治的
美国
美国
国家
政治的
90056
90056
邮政编码
33.9978986
-118.3696586
插值范围
33.9965523
-118.3709990
33.9992503
-118.3683010
33.9978986
-118.3696586
33.9979040
-118.3696414
真的

在经典ASP中启动XML文档,一旦完成,请尝试使用XPath

Set docXML = CreateObject( "Microsoft.XMLDOM" ) 
docXML.async = False 
docXML.loadXML( myXMLText )
为了拿到lat

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


用于获取格式化地址。

在经典ASP中启动XML文档,一旦完成,请尝试使用XPath

Set docXML = CreateObject( "Microsoft.XMLDOM" ) 
docXML.async = False 
docXML.loadXML( myXMLText )
为了拿到lat

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


用于获取格式化地址。

谢谢!虽然我在看到你的帖子之前就知道了。谢谢!虽然我在看到你的帖子之前就知道了。