I'm working with the Google Maps API to do GeoCode lookups in 1.1 and I'm running into a brick wall with the XPathNavigator object.
I need to create a "sub-navigator" so that we can perform global xpath searches for nodes (e.g. //adr:PostalCodeNumber) because the xml schema changes depending upon the accuracy of the Address returned.
Here's a sample response:
<kml xmlns="http://earth.google.com/kml/2.0"><Response>
<name>2601 S. McKenzie Street </name>
<Status>
<code>200</code>
<request>geocode</request>
</Status>
<Placemark id="p1">
<address>2601 S McKenzie St, Foley, AL 36535, USA</address>
<AddressDetails Accuracy="8" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>US</CountryNameCode><CountryName>USA</CountryName><AdministrativeArea><AdministrativeAreaName>AL</AdministrativeAreaName><Locality><LocalityName>Foley</LocalityName><Thoroughfare><ThoroughfareName>2601 S McKenzie St</ThoroughfareName></Thoroughfare><PostalCode><PostalCodeNumber>36535</PostalCodeNumber></PostalCode></Locality></AdministrativeArea></Country></AddressDetails>
<ExtendedData>
<LatLonBox north="30.3733653" south="30.3706673" east="-87.6817548" west="-87.6844528" />
</ExtendedData>
<Point><coordinates>-87.6831038,30.3720163,0</coordinates></Point>
</Placemark>
<Placemark id="p2">
<address>2601 S McKenzie St, Gulf Shores, AL 36542, USA</address>
<AddressDetails Accuracy="8" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">
<Country> <CountryNameCode>US</CountryNameCode><CountryName>USA</CountryName><AdministrativeArea><AdministrativeAreaName>AL</AdministrativeAreaName><Locality><LocalityName>Gulf Shores</LocalityName><Thoroughfare><ThoroughfareName>2601 S McKenzie St</ThoroughfareName></Thoroughfare><PostalCode><PostalCodeNumber>36542</PostalCodeNumber></PostalCode></Locality></AdministrativeArea></Country></AddressDetails>
<ExtendedData>
<LatLonBox north="30.3093758" south="30.3066778" east="-87.6818443" west="-87.6845423" />
</ExtendedData>
<Point><coordinates>-87.6832047,30.3080269,0</coordinates></Point>
</Placemark>
</Response></kml>
I've got this 2.0 block of code and I'm trying to find a 1.1 equivalent for the OuterXml property:
private XPathNavigator CreateSubNavigator(XPathNavigator nav)
{
using (StringReader reader = new StringReader(nav.OuterXml))
{
XPathDocument doc = new XPathDocument(reader);
return doc.CreateNavigator();
}
}
I found this blog article, but the links to the SerializableXPathNavigator source are dead. =(
http://www.tkachenko.com/blog/archives/000155.html
Forgive me for my noobness, but how would I go about writing my own SerializableXPathNavigator class with my o开发者_如何学Pythonwn OuterXml method?
Thanks so much for your help.
精彩评论