public static NodeList selectNodeList(Node doc,String str,NamespaceContext nsctx) throws XPathException {
  XPathFactory xpf=xpathFactoryCache.getInstanceForCurrentThread();
  XPath xpath=xpf.newXPath();
  xpath.setNamespaceContext(nsctx);
  XPathExpression expr=xpath.compile(str);
  return (NodeList)expr.evaluate(doc,XPathConstants.NODESET);
}

public static NodeList selectNodeList ( Node doc , String str , NamespaceContext nsctx ) throws XPathException { XPathFactory xpf = xpathFactoryCache . getInstanceForCurrentThread ( ) ; XPath xpath = xpf . newXPath ( ) ; xpath . setNamespaceContext ( nsctx ) ; XPathExpression expr = xpath . compile ( str ) ; return ( NodeList ) expr . evaluate ( doc , XPathConstants . NODESET ) ; }
use an xpath string to select a nodelist namespace prefix is resolved using the the specified context .
