public abstract Object evaluate(Node context, int pos, int len);
public Object evaluate(Object item, QName returnType) throws XPathExpressionException { Object ret = null; Node context = null; if (item instanceof Node) { context = (Node) item; ret = evaluate(context, 1, 1); if (XPathConstants.STRING == returnType && !(ret instanceof String)) { ret = _string(context, ret); } else if (XPathConstants.NUMBER == returnType && !(ret instanceof Double)) { ret = new Double(_number(context, ret)); } else if (XPathConstants.BOOLEAN == returnType && !(ret instanceof Boolean)) { ret = _boolean(context, ret) ? Boolean.TRUE : Boolean.FALSE; } else if (XPathConstants.NODE == returnType) { if (ret instanceof Collection) { Collection ns = (Collection) ret; switch (ns.size()) { case 0: ret = null; break; case 1: ret = (Node) ns.iterator().next(); break; default: throw new XPathExpressionException("multiple nodes in node-set"); } } else if (ret != null) { throw new XPathExpressionException("return value is not a node-set"); } } else if (XPathConstants.NODESET == returnType) { if (ret != null && !(ret instanceof Collection)) { throw new XPathExpressionException("return value is not a node-set"); } } } return ret; }
  public abstract Object evaluate(Node context, int pos, int len);