I'm using the Google Maps API to geocode some addresses. What is the easiest way to build objects using the childnodes of <Placemark>
? I may also have multiple placemarks returned in the same response depending on the level of detail provided in the request. I would like to build multiple objects in those cases and those objects will be added to a colection for additional processing.
I already have my Placemark class created and the desired properties ahve been defined within it. I just need to process the response and build my objects.
<?xml version="1.0" encoding="UTF-8" ?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Response>
<name>300 college ave, appleton, wi</name>
<Status>
<code>200</code>
<request>geocode</request>
</Status>
<Placemark id="p1">
<address>300 W College Ave, Appleton, WI 54911, USA</address>
<AddressDetails Accuracy="8" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">
<Country>
<CountryNameCode>US</CountryNameCode>
<CountryName>USA</CountryName>
<AdministrativeArea>
<AdministrativeAreaName>WI</AdministrativeAreaName>
<SubAdministrativeArea>
<SubAdministrativeAreaName>Outagamie</SubAdministrativeAreaName>
<Locality>
<LocalityName>Appleton</LocalityName>
<Thoroughfare>
<ThoroughfareName>300 W College Ave</ThoroughfareName>
</Thoroughfare>
<PostalCode>
<PostalCodeNumber>54911</PostalCodeNumber>
</PostalCode>
</Locality>
</SubAdministrativeArea>
</AdministrativeArea>
</Country>
</AddressDetails>
<ExtendedData>
<LatLonBox north="44.2649615" south="44.2586663" east="-88.4055893" west="-88.4118845" />
</ExtendedData>
<Point>
<coordinates>-88.4087369,44.2618139,0</coordinates>
</Point>
</Placemark>
<Placemark id="p2">
<address>300 E College Ave, Appleton, WI 54911, USA</address>
<AddressDetails Accuracy="8" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">
<Country>
<CountryNameCode>US</CountryNameCode>
<CountryName>USA</CountryName>
<AdministrativeArea>
<AdministrativeAreaName>WI</AdministrativeAreaName>
<SubAdministrativeArea>
<SubAdministrativeAreaName>Outagamie</SubAdministrativeAreaName>
<Locality>
<LocalityName>Appleton</LocalityName>
<Thoroughfare>
<ThoroughfareName>300 E College Ave</ThoroughfareName>
</Thoroughfare>
<PostalCode>
<PostalCodeNumber>54911</PostalCodeNumber>
</PostalCode>
</Locality>
</SubAdministrativeArea>
</AdministrativeArea>
</Country>
</AddressDetails>
<ExtendedData>
<LatLonBox north="44.2649487" south="44.2586535" east="-88.3995668" west="-88.4058620" />
</ExtendedData>
<Point>
<coordinates>-88.4027144,44.2618011,0</coordinates>
</Point>
</Placemark>
</Response>
</kml>