title: XPath and XML: Multiple namespaces
body: <p>So I have a document that looks like</p>
  
  <pre><code>&lt;a xmlns="uri1" xmlns:pre2="uri2"&gt;
   &lt;b xmlns:pre3="uri3"&gt;
     &lt;pre3:c&gt;
       &lt;stuff&gt;&lt;/stuff&gt;
       &lt;goes&gt;&lt;/goes&gt;
       &lt;here&gt;&lt;/here&gt;
     &lt;/pre3:c&gt;
     &lt;pre3:d xmlns="uri4"&gt;
       &lt;under&gt;&lt;/under&gt;
       &lt;the&gt;&lt;/the&gt;
       &lt;tree&gt;&lt;/tree&gt;
     &lt;/pre3:d&gt;
    &lt;/b&gt;
  &lt;/a&gt;
  </code></pre>
  
  <p>I want an xpath expression that will get me <code>&lt;under&gt;</code>.</p>
  
  <p>This has a namespaceURI of uri4.</p>
  
  <p>Right now my expression looks like: </p>
  
  <pre><code>//ns:a/ns:b/pre3:d/pre4:under
  </code></pre>
  
  <p>I have the namespace manager add 'ns' for the default namespace (uri1 in this case) and I have it defined with pre2, pre3, and pre4 for uri2, uri3, and uri4 respectively.</p>
  
  <p>I get the error <em>"Expression must evaluate to a node-set."</em></p>
  
  <p>I know that the node exists.  I know that everything up until the <code>pre4:under</code> in my xpath works fine as I use it in the rest of the document with no issues.  It's the additional <code>pre4:under</code> that causes the error, and I'm not sure why.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks.</p>
  
  <p><strong>Resolution:</strong></p>
  
  <p>Thank you all for your insistence that it's correct--it was.  But... in my code I had "pre4" as "64" (a variable) and it didn't like an integer for a prefix.  Changing it to "d" + myintvariable worked.</p>