super.clone();
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final AbstractXPathCompiled. | |
| private final Filter | |
| private final Map | |
| private final String | |
| private Map |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public XPathExpression | clone()
Overrides java. Implements org. |
| public XPathDiagnostic | diagnose(Object
The context against which to run the query. context, boolean Indicate whether the XPath expression can be terminated after the
first successful result value. firstonly)Implements org. |
| public List | evaluate(Object
The context against which to process the query. context)Implements org. |
| public T | evaluateFirst(Object
The context against which to evaluate the expression. This will
typically be a Document, Element, or some other JDOM object. context)Implements org. |
| protected abstract List | Returns: A list of XPath results.The context against which to evaluate the query context)This is the raw expression evaluator to be implemented by the back-end XPath library. |
| protected abstract Object | Returns: The first item in the XPath results, or null if there are no results.The context against which to evaluate the query context)This is the raw expression evaluator to be implemented by the back-end XPath library. |
| public final String | |
| public final Filter | getFilter()
Implements org. Filter<T> used to coerce the raw XPath results in to
the correct Generic type.
|
| public final Namespace | getNamespace(final String
The prefix to select the Namespace URI for. prefix)Implements org. |
| public Namespace[] | getNamespaces()
Implements org. |
| private static final String | Returns: the prefix of the namespacethe URI to search for uri, final Namespace[] the array of namespaces to search through nsa)Utility method to find a Namespace that has a given URI, and return the prefix. |
| public final Object | getVariable(final String
the variable localname to retrieve the value for. name, Namespace the Namespace in which the variable name was declared. uri)Implements org. |
| public Object | getVariable(String
the variable qname to retrieve the value for. qname)Implements org. |
| protected Map | Returns: the variables set on this instance.utility method that allows descendant classes to access the variables that were set on this expression, in a format that can be used in a constructor (qname/value). |
| public Object | setVariable(String
The variable localname to change. name, Namespace the Namespace in which the variable name is declared. uri, Object The new value to set. value)Implements org. |
| public Object | setVariable(String
The variable qname to change. qname, Object The new value to set. value)Implements org. |
| public String |
| NSSORT | back to summary |
|---|---|
| private static final AbstractXPathCompiled. | |
| xfilter | back to summary |
|---|---|
| private final Filter<T> xfilter | |
| xnamespaces | back to summary |
|---|---|
| private final Map<String, Namespace> xnamespaces | |
| xquery | back to summary |
|---|---|
| private final String xquery | |
| xvariables | back to summary |
|---|---|
| private Map<String, Map<String, Object>> xvariables | |
| AbstractXPathCompiled | back to summary |
|---|---|
| public AbstractXPathCompiled(final String query, final Filter<T> filter, final Map<String, Object> variables, final Namespace[] namespaces) Construct an XPathExpression.
| |
| clone | back to summary |
|---|---|
| public XPathExpression Overrides java. Implements org. Doc from org. Subclasses of this AbstractXPathCompile class must call super.clone() in their clone methods!
This would be a sample clone method from a subclass:
Create a new instance of this XPathExpression that duplicates this instance. The 'cloned' instance will have the same XPath query, namespace declarations, and variables. Changing a value associated with a variable on the cloned instance will not change this instance's values, and it is safe to run the evaluate methods on the cloned copy at the same time as this copy.
| |
| diagnose | back to summary |
|---|---|
| public XPathDiagnostic Implements org. Doc from org. Evaluate the XPath query against the supplied context, but return additional data which may be useful for diagnosing problems with XPath queries.
| |
| evaluate | back to summary |
|---|---|
| public List Implements org. Doc from org. Process the compiled XPathExpression against the specified context.
In the JDOM2 XPath API the results of the raw XPath query are processed
by the attached | |
| evaluateFirst | back to summary |
|---|---|
| public T evaluateFirst(Object context) Implements org. Doc from org. Return the first value in the XPath query result set type-cast to the return type of this XPathExpression. The concept of the 'first' result is applied before any JDOM Filter is applied. Thus, if the underlying XPath query has some results, the first result is sent through the filter. If it matches it is returned, if it does not match, then null is returned (even if some subsequent result underlying XPath result would pass the filter). This allows the XPath implementation to optimise the evaluateFirst method by potentially using 'short-circuit' conditions in the evaluation.
| |
| evaluateRawAll | back to summary |
|---|---|
| protected abstract List This is the raw expression evaluator to be implemented by the back-end XPath library. | |
| evaluateRawFirst | back to summary |
|---|---|
| protected abstract Object evaluateRawFirst(Object context) This is the raw expression evaluator to be implemented by the back-end XPath library. When this method is processed the implementing library is free to stop processing when the result that would be the first result is retrieved. Only the first value in the result will be processed (if any). | |
| getExpression | back to summary |
|---|---|
| public final String getExpression() Implements org. Doc from org. Get the XPath expression | |
| getFilter | back to summary |
|---|---|
| public final Filter Implements org. Doc from org. Get the | |
| getNamespace | back to summary |
|---|---|
| public final Namespace getNamespace(final String prefix) Implements org. Doc from org. Get the Namespace associated with a given prefix. | |
| getNamespaces | back to summary |
|---|---|
| public Namespace[] getNamespaces() Implements org. Doc from org. Get the Namespaces that were used to compile this XPathExpression. | |
| getPrefixForURI | back to summary |
|---|---|
| private static final String getPrefixForURI(final String uri, final Namespace[] nsa) Utility method to find a Namespace that has a given URI, and return the prefix. | |
| getVariable | back to summary |
|---|---|
| public final Object getVariable(final String name, Namespace uri) Implements org. Doc from org. Get the variable value associated to the given variable name. | |
| getVariable | back to summary |
|---|---|
| public Object getVariable(String qname) Implements org. Doc from org. Get the variable value associated to the given variable qname.
qname must consist of an optional namespace prefix and colon, followed
by a mandatory variable localname. If the prefix is not specified, then
the Namespace is assumed to be the | |
| getVariables | back to summary |
|---|---|
| protected Map utility method that allows descendant classes to access the variables that were set on this expression, in a format that can be used in a constructor (qname/value). | |
| setVariable | back to summary |
|---|---|
| public Object setVariable(String name, Namespace uri, Object value) Implements org. Doc from org. Change the defined value for a variable to some new value. You may not use this method to add new variables to the compiled XPath, you can only change existing variable values. The value of the variable may be null. Some XPath libraries support a null value, and if the library that this expression is for does not support a null value it should be translated to something meaningful for that library, typically the empty string. | |
| setVariable | back to summary |
|---|---|
| public Object setVariable(String qname, Object value) Implements org. Doc from org. Change the defined value for a variable to some new value. You may not use this method to add new variables to the compiled XPath, you can only change existing variable values. The value of the variable may be null. Some XPath libraries support a null value, and if the library that this expression is for does not support a null value it should be translated to something meaningful for that library, typically the empty string.
qname must consist of an optional namespace prefix and colon, followed
by a mandatory variable localname. If the prefix is not specified, then
the Namespace is assumed to be the | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public int | compare(Namespace
the first object to be compared. ns1, Namespace the second object to be compared. ns2)Implements java. |
| NamespaceComparator | back to summary |
|---|---|
| private NamespaceComparator() | |
| compare | back to summary |
|---|---|
| public int compare(Namespace ns1, Namespace ns2) Implements java. Doc from java. Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
The implementor must ensure that
The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that | |