Public interfaces for XPath expression Abstract Syntax Tree nodes.
Primary external APIs for this XPath AST model.
The XPath API is a compact set of Java interfaces that allow
in-memory representation and manipulation of XPath 2.0 expressions.The
main idea of this API is to manipulate XPath expressions independently
of their actual underlying representation (since most of XPath
processors use different representations for optimization purpose).
It was designed to fulfill
the following requirements:
- Read/Write: it should be able to query/visit
and modifying the
internal representation of XPath expressions. The expression reading is
performed by using either the visitor pattern or get-like methods.
Similarly, the expression writing is done through a bunch of
set-like methods.
- Round-trip: it should be able to
get
back string representation of expressions from their internal
representation.
- Application-independent:
it should be suitable to be used by a variety of applications
efficiently. It should provide
solutions to plug in application-dependent features, like
namespace/qname manager and AST generalization and specialisation (see
implementation package).
- Lightweight: it should be compact and therefore it
should
define a minimal set of Java interfaces in particular by factoring
similar concepts. The best example is the
interface OperatorExpr which allows
the representation of more than ten
expression types.
The XPath API by itself do not define how to bind expressions with an
XPath processor. However, this can easily be done using the XPath invocation API defined in JSR 206
and using the round-trip feature of this API.
The starting point to handle XPath expressions is the class Expr. Enjoy!