XPath API implementation built on the top of Jaxen.
Package Specification
This package delivers implementation of XPath API built on the top of Jaxen.
This package is kind of wrapper/gateway that encapsulates Jaxen calls into API we need.
Diagram bellow shows relations between Jaxen, XPath API and this package.
Jaxen
Jaxen is an efficient, powerful, free and open-source implementation of XPath 1.0.
Features:
- Fully compatible with XPath 1.0,
- Precompiled xpath expressions - xpath can be compiled once and used many times with
different documents and variable mappings,
- Variable resolving - variables are resolved at execution time, not at compilation time.
Jaxen requires dedicated variable resolver that can be easily built on the top of
any map.
Source data format
In general, Jaxen can work with many different XML document sources (W3C DOM, JDOM, etc.).
This wrapper is configured to work only with W3C DOM source (see section Assumptions bellow).
Examples
To start using this implementation simply instantiate engine using constructor
{@link org.xdv.xpath.jaxen.JaxenXPathEngine#JaxenXPathEngine}.
After that you can proceed in a way described in example section in package {@link org.xdv.xpath}.
Assumptions, limitations
- It requires Jaxen 1.x package to work.
Binary version (*.jar) can be downloaded from Jaxen project home page.
- Implementation works only with W3C DOM source. It means that:
- It takes {@link org.w3c.dom.Document} object as XML document.
For instance: {@link org.xdv.xpath.jaxen.JaxenXPathEngine#createExecutionUnit(java.lang.Object)}.
- It takes {@link org.w3c.dom.Node} object as a XML node.
For instance: {@link org.xdv.xpath.jaxen.JaxenXPathEngine#createValueNode(java.lang.Object)}.
- This implementation relaxes requirements from XPath API ({@link org.xdv.xpath})
which says that expression and execution-unit work together only if they were created by
exactly the same engine instance.
Using this implementation you can create expression and execution-unit using different instances of
{@link org.xdv.xpath.jaxen.JaxenXPathEngine} and they will still work together.
Related Documentation
For overviews, examples please see:
- Jaxen - Jaxen project home page
- General info - general information about
this documentation, global assumptions, etc.