public static Node selectSingleNode(Node doc,String str,NamespaceContext nsctx) throws XPathException {
  NodeList nl=selectNodeList(doc,str,nsctx);
  if (nl.getLength() == 0) {
    return null;
  }
  return nl.item(0);
}

public static Node selectSingleNode ( Node doc , String str , NamespaceContext nsctx ) throws XPathException { NodeList nl = selectNodeList ( doc , str , nsctx ) ; if ( nl . getLength ( ) == 0 ) { return null ; } return nl . item ( 0 ) ; }
use an xpath string to select a single node using a passed in namespace context .
