title: How to read an XPathDocument that has a namespace
body: <p>I have the following example XML file:</p>
  
  <pre><code>&lt;Top xmlns="abbr:SomeNSValue"&gt;
    &lt;Next&gt;
      &lt;Other&gt;SomeValue&lt;/Other&gt;
    &lt;/Next&gt;
  &lt;/Top&gt;
  </code></pre>
  
  <p>I load it up and try to read it like this:</p>
  
  <pre><code>FileStream stream = new FileStream(@".\TestXML.xml", FileMode.Open);
  XPathDocument xPathDocument = new XPathDocument(stream);
  XPathNavigator navigator = xPathDocument.CreateNavigator();
  
  XmlNamespaceManager ns = null;
  if (navigator.NameTable != null)
  {
      ns = new XmlNamespaceManager(navigator.NameTable);
      ns.AddNamespace("abbr", "SomeNSValue");
  }
  
  XPathNodeIterator iterator = navigator.Select("/Top/Next", ns);
  iterator.MoveNext();
  
  Console.WriteLine(iterator.Current.InnerXml);
  </code></pre>
  
  <p>This outputs the Full XML shown above.  Not what I am looking for (I want to select the contents of the "Next" node.</p>
  
  <p>But if I take the <code>xmlns="abbr:SomeNSValue</code> out of the XML and try again then I get what I was looking for:</p>
  
  <pre><code>&lt;Other&gt;SomeValue&lt;/Other&gt;
  </code></pre>
  
  <p>In my real scenario I have the XML fed to me and I would rather not have to modify it to take the Namespace off.</p>
  
  <p>Is there a way I can make this work with the namespace in it?</p>
  
  <p><strong>Note:</strong> Incase it matters this is the actual namespace that I have in my XML file: <code>xmlns="urn:hl7-org:v2xml"</code></p>