|
JDOM 2.0.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdom2.xpath.XPathFactory
org.jdom2.xpath.jaxen.JaxenXPathFactory
public class JaxenXPathFactory
This simple Factory creates XPath instances tailored to the Jaxen library.
Constructor Summary | |
---|---|
JaxenXPathFactory()
The public default constructor used by the XPathFactory. |
Method Summary | ||
---|---|---|
|
compile(java.lang.String expression,
Filter<T> filter,
java.util.Map<java.lang.String,java.lang.Object> variables,
Namespace... namespaces)
Create a Compiled XPathExpression<> instance from this factory. |
Methods inherited from class org.jdom2.xpath.XPathFactory |
---|
compile, compile, compile, instance, newInstance |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JaxenXPathFactory()
Method Detail |
---|
public <T> XPathExpression<T> compile(java.lang.String expression, Filter<T> filter, java.util.Map<java.lang.String,java.lang.Object> variables, Namespace... namespaces)
XPathFactory
XPathFactory implementations override this method to implement support for the JDOM/XPath API.
This compile method ensures that these XPath/Namespace rules are followed and thus this method will throw IllegalArgumentException if:
Variables are referenced from XPath expressions using a
$varname
syntax. The variable name may be a Namespace
qualified variable name of the form $pfx:localname
.
Variables $pa:var
and $pb:var
are the identical
variables if the namespace URI for prefix 'pa' is the same URI as for
prefix 'pb'.
This compile method expects all variable names to be expressed in a prefix-qualified format, where all prefixes have to be available in one of the specified Namespace instances.
e.g. if you specify a variable name "ns:var" with value "value", you also
need to have some namespace provided with the prefix "ns" such as
Namespace.getNamespace("ns", "http://example.com/nsuri");
Some XPath libraries allow null variable values (Jaxen), some do not
(native Java). This compile method will silently convert any null
Variable value to an empty string ""
.
Variables are provided in the form of a Map where the key is the variable name and the mapped value is the variable value. If the entire map is null then the compile Method assumes there are no variables.
In light of the above, this compile method will throw an IllegalArgumentException if:
compile
in class XPathFactory
T
- The generic type of the results that the XPathExpression will
produce.expression
- The XPath expression.filter
- The Filter that is used to coerce the xpath result data in to the
generic-typed results.variables
- Any variable values that may be referenced from the query. A null
value indicates that there are no variables.namespaces
- Any namespaces that may be referenced from the query
|
JDOM 2.0.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |