AnsweredAssumed Answered

Extrat data from xml, using Web Viewer

Question asked by smalco on Mar 30, 2011
Latest reply on Mar 30, 2011 by smalco

Title

Extrat data from xml, using Web Viewer

Post

Hi,
I would like to extract data which I obtain using Geocoding which I display in the web viewer.
How to extract/parse the data so that I can extract the city (locality) & postal code?
Below the generated xml which is displayed in the web viewer.
<?xml version="1.0" encoding="UTF-8" ?>
<GeocodeResponse>
<status>OK</status>
<result>
<type>street_address</type>
 <formatted_address>Taborastraat 1, 8300 Knokke-Heist,  Belgium</formatted_address>
 <address_component>
<long_name>1</long_name>
 <short_name>1</short_name>
 <type>street_number</type>
 </address_component>
 <address_component>
 <long_name>Taborastraat</long_name>
 <short_name>Taborastraat</short_name>
<type>route</type>
</address_component>
<address_component>
<long_name>Knokke-Heist</long_name>
<short_name>Knokke-Heist</short_name>
<type>locality</type>
<type>political</type>
</address_component>
<address_component>
<long_name>West-Vlaanderen</long_name>
<short_name>WV</short_name>
<type>administrative_area_level_2</type>
<type>political</type>
</address_component>
<address_component>
<long_name>Flemish Region</long_name>
<short_name>Flemish Region</short_name>
<type>administrative_area_level_1</type>
<type>political</type>
</address_component>
<address_component>
<long_name>Belgium</long_name>
<short_name>BE</short_name>
<type>country</type>
<type>political</type>
</address_component>
<address_component>
<long_name>8300</long_name>
<short_name>8300</short_name>
<type>postal_code</type>
</address_component>
<geometry>
<location>
<lat>51.3513992</lat>
<lng>3.2888279</lng>
</location>
<location_type>RANGE_INTERPOLATED</location_type>
<viewport>
<southwest>
<lat>51.3482576</lat>
<lng>3.2856815</lng>
</southwest>
<northeast>
<lat>51.3545529</lat>
<lng>3.2919768</lng>
</northeast>
</viewport>
<bounds>
<southwest>
<lat>51.3513992</lat>
<lng>3.2888279</lng>
</southwest>
<northeast>
<lat>51.3514113</lat>
<lng>3.2888304</lng>
</northeast>
</bounds>
</geometry>
</result>
</GeocodeResponse>
Thanks,
Smalco

Outcomes