title: XPath evaluation with Saxon doesn't work for nodename
body: <p>Why doesn't the following xpath return any results with Saxon 9.6 in Java?</p>
  
  <p><code>//field</code></p>
  
  <p>The strange part is I also evaluated <code>//*</code> and looped over the results comparing the nodeNames with "field" and got 889 hits for my document.</p>
  
  <p>Full codeexample below:</p>
  
  <p>Initializing and running the test:</p>
  
  <pre><code>DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
  DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
  Document doc = dBuilder.parse(file);
  
  
  test(doc, "//*");
  test(doc, "//field");
  </code></pre>
  
  <p>Test execution code:</p>
  
  <pre><code>private void test(Document doc, String xpathString) throws Exception {
      System.setProperty("javax.xml.xpath.XPathFactory:" + NamespaceConstant.OBJECT_MODEL_SAXON, "net.sf.saxon.xpath.XPathFactoryImpl");
      XPathFactory xpf;
      xpf = XPathFactory.newInstance(NamespaceConstant.OBJECT_MODEL_SAXON);
  
      XPath xpath = xpf.newXPath();
  
      XPathExpression expr = xpath.compile(xpathString);
  
      Object result = expr.evaluate(doc, XPathConstants.NODESET);
      NodeList nodes = (NodeList) result;
  
      int fieldHits = 0;
      for (int i = 0; i &lt; nodes.getLength(); i++) {
          Node node = nodes.item(i);
          String name = node.getNodeName();
          fieldHits = "field".equals(nodes.item(i).getNodeName()) ? fieldHits + 1 : fieldHits;
      }
  
      System.out.println("#hits total: " + nodes.getLength());
      System.out.println("#hits 'field': " + fieldHits);
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>#hits total: 26256
  #hits 'field': 889
  #hits total: 0
  #hits 'field': 0
  </code></pre>
  
  <p>Example XML-File (thanks to wero I now know it has something to do with namespaces):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;?xfa generator="AdobeLiveCycleDesignerES_V9.0.1.0.20091206.1.615263" APIVersion="3.2.9310.0"?&gt;
  &lt;xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/" timeStamp="2015-11-17T07:12:49Z" uuid="262c190c-1563-4ae8-ae6e-4c8d59494a3c"&gt;
  &lt;template xmlns:xliff="urn:oasis:names:tc:xliff:document:1.1" xmlns="http://www.xfa.org/schema/xfa-template/2.8/"&gt;
      &lt;field name="A"&gt;&lt;/field&gt;
      &lt;field name="B"&gt;&lt;/field&gt;
      &lt;field name="C"&gt;&lt;/field&gt;
      &lt;field name="D"&gt;&lt;/field&gt;
      &lt;field name="E"&gt;&lt;/field&gt;
      &lt;field name="F"&gt;&lt;/field&gt;
  &lt;/template&gt;
  &lt;/xdp:xdp&gt;
  </code></pre>