When you run the following code, StatusCode is returned as null. What am I doing wrong?
var xml = @"<?xml version='1.0' encoding='UTF-8'?>
<kml xmlns='http://earth.google.com/kml/2.0'>
<Response>
<name>The Name</name>
<Status>
<code>200</code>
<request>geocode</request>
</Status>
</Response>
</kml>";
XmlDocument XmlDoc = new XmlDocument();
ASCIIEncoding Enc = new System.Text.ASCIIEncoding();
using (MemoryStream Stream = new MemoryStream(Enc.GetBytes(xml)))
{
XmlDoc.Load(Stream);
}
XmlElement Root = XmlDoc.DocumentElement;
XmlNamespaceManager XmlNS = new XmlNamespaceManager(XmlDoc.NameTable);
XmlNS.AddNamespace("default", Root.NamespaceURI);
XmlNode XmlResults = Root.SelectSingleNode("//default:Response", XmlNS);
XmlNode StatusCode = XmlResults.SelectSingleNode("Status/code");
Thanks in advance!