try {
ElementWrapper root = makeRoot(context);
List<Object> s = new ArrayList<Object>();
Object n = prepare(xpath, root).selectSingleNode(root.getFirstChild());
if (n == null)
throw new XMLXPathException("no node selected");
s.add(n);
List<Node> sel = copyNodes(root, s, remove_successors);
if (sel.isEmpty()) // root is removed by copyNodes if selected
throw new XMLXPathException("no node selected");
return new NodeResult(getRealFirstChild(root), sel.get(0));
} catch (JaxenException e) {
throw new XMLXPathException(e);
} catch (JaxenRuntimeException e) {
throw new XMLXPathException(e.getCause());
}
}