From the following GeoCodeRespose xml how can we extract values of locality, route and street number using xpath in a c# program.
<GeocodeResponse>
<status>OK</status>
<result>
<type>street_address</type>
<formatted_address>1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA</formatted_address>
<address_component>
<long_name>1600</long_name>
<short_name>1600</short_name>
<type>street_number</type>
</address_component>
<address_component>
<long_name>Amphitheatre Pkwy</long_name>
<short_name>Amphitheatre Pkwy</short_name>
<type>route</type>
</address_component>
<address_component>
<long_name>Mountain View</long_name>
<short_name>Mountain View</short_name>
<type>locality</type>
<type>political</type>
</address_component>
</result>
</GeocodeResponse>
so far I can get the xml in the xml document and can get the value of formatted address as below
XmlDocument doc=GetGeoCodeXMLResponse();
XPathDocument document = new XPathDocument(new XmlNodeReader(doc));
XPathNavigator navigator = document.CreateNavigator();
XPathNodeIterator resultIterator = navigator.Select("/GeocodeResponse/result");
while (resultIterator.MoveNext())
{
XPathNodeIterator formattedAddressIterator = resultIterator.Current.Select("formatted_address");
while (formattedAddressIterator.MoveNext())
{
string FullAddress = formattedAddressIterator.Current.Value;
}
}