title: xpath search on subtree
body: <p>I need to restrict the xpath node search to a subtree. I'm currently using the method below but it searches on a whole document regardlest whether I give it the document or the node I want to search from.</p>
  
  <pre><code>private NodeList findNodes(Object obj,String xPathString) throws ... {
      XPath xPath = XPathFactory.newInstance().newXPath();
      XPathExpression expression = xPath.compile(xPathString);
      return (NodeList) expression.evaluate(obj, XPathConstants.NODESET);
  }
  </code></pre>
  
  <p>Solution I'm using now is that I create new document, append the node and search on the new document, then merge. I want to improve this. Can it be done?</p>
  
  <p>The XPath I'm using is <code>//nodeName</code>.</p>