public Element selectElementMatchingXPath(String xpath,Element toSearch){
  List<Element> results=selectElementsMatchingXPath(xpath,toSearch);
  if (results.isEmpty()) {
    throw new ElementNotFoundException(xpath,toSearch);
  }
  Element match=results.get(0);
  return match;
}

public Element selectElementMatchingXPath ( String xpath , Element toSearch ) { List < Element > results = selectElementsMatchingXPath ( xpath , toSearch ) ; if ( results . isEmpty ( ) ) { throw new ElementNotFoundException ( xpath , toSearch ) ; } Element match = results . get ( 0 ) ; return match ; }
the following will search the given element for the specified xpath and return any node that matches .
