| Modifier and Type | Field and Description |
|---|---|
| private final JDOM2Navigator | navigator
The current context for XPath expression evaluation. |
| private final XPath | xPath
The compiled XPath object to select nodes. |
| Access | Constructor and Description |
|---|---|
| public | |
| private | JaxenCompiled(JaxenCompiled<T>
The JaxenCompiled instance to clone toclone)Make a copy-constructor available to the clone() method. |
| Modifier and Type | Method and Description |
|---|---|
| public JaxenCompiled | clone()
Overrides org. Implements org. |
| protected List | evaluateRawAll(Object
The context against which to evaluate the query context)Implements abstract org. |
| protected Object | evaluateRawFirst(Object
The context against which to evaluate the query context)Implements abstract org. |
| public Object | getVariableValue(String
the namespace URI to which the prefix parameter
is bound in the XPath expression. If the variable
reference expression had no prefix, the namespace
URI is namespaceURI, String null.the prefix that was used in the variable reference
expression; this value is ignored and has no effect prefix, String the local name of the variable-reference
expression. If there is no prefix, then this is
the whole name of the variable. localName)Implements org. |
| public String | translateNamespacePrefixToUri(String
the namespace prefix to resolve prefix)Implements org. |
| private static final List | |
| private static final Object |
| navigator | back to summary |
|---|---|
| private final JDOM2Navigator navigator The current context for XPath expression evaluation. The navigator is responsible for exposing JDOM content to Jaxen, including the wrapping of Namespace instances in NamespaceContainer Because of the need to wrap Namespace, we also need to unwrap namespace. Further, we can't re-use the details from one 'selectNodes' to another because the Document tree may have been modified between, and also, we do not want to be holding on to memory. Finally, we want to pre-load the NamespaceContext with the namespaces that are in scope for the contextNode being searched. So, we need to reset the Navigator before and after each use. try{} finally {} to the rescue. | |
| xPath | back to summary |
|---|---|
| private final XPath xPath The compiled XPath object to select nodes. This attribute can not be made final as it needs to be set upon object deserialization. | |
| JaxenCompiled | back to summary |
|---|---|
| public JaxenCompiled(String expression, Filter<T> filter, Map<String, Object> variables, Namespace[] namespaces) | |
| JaxenCompiled | back to summary |
|---|---|
| private JaxenCompiled(JaxenCompiled<T> toclone) Make a copy-constructor available to the clone() method. This is simpler than trying to do a deep clone anyway.
| |
| clone | back to summary |
|---|---|
| public JaxenCompiled Overrides org. 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.
| |
| evaluateRawAll | back to summary |
|---|---|
| protected List Implements abstract org. Doc from org. This is the raw expression evaluator to be implemented by the back-end XPath library. | |
| evaluateRawFirst | back to summary |
|---|---|
| protected Object evaluateRawFirst(Object context) Implements abstract org. Doc from org. 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). | |
| getVariableValue | back to summary |
|---|---|
| public Object getVariableValue(String namespaceURI, String prefix, String localName) throws UnresolvableException Implements org. Doc from org. An implementation should return the value of an XPath variable based on the namespace URI and local name of the variable-reference expression. It must not use the prefix parameter to select a variable, because a prefix could be bound to any namespace; the prefix parameter could be used in debugging output or other generated information. The prefix may otherwise be ignored.
| |
| translateNamespacePrefixToUri | back to summary |
|---|---|
| public String translateNamespacePrefixToUri(String prefix) Implements org. Doc from org. Translate the provided namespace prefix into the matching bound namespace URI. In XPath, there is no such thing as a 'default namespace'. The empty prefix always resolves to the empty namespace URI. This method should return null for the empty prefix. Similarly, the prefix "xml" always resolves to the URI "http://www.w3.org/XML/1998/namespace". | |
| unWrap | back to summary |
|---|---|
| private static final List Same story, need to be able to replace NamespaceContainer instances with Namespace content. | |
| unWrapNS | back to summary |
|---|---|
| private static final Object unWrapNS(Object o) Same story, need to be able to strip NamespaceContainer instances from Namespace content. | |