public class AXIOMXPath
extends org.jaxen.BaseXPath
Constructor and Description |
---|
AXIOMXPath(OMAttribute attribute)
Construct an XPath expression from a given attribute.
|
AXIOMXPath(OMElement element,
String xpathExpr)
Construct an XPath expression from a given string and initialize its
namespace context based on a given element.
|
AXIOMXPath(String xpathExpr)
Construct an XPath expression from a given string.
|
Modifier and Type | Method and Description |
---|---|
void |
addNamespace(String prefix,
String uri)
This override captures any added namespaces, as the Jaxen BaseXPath class nor
NamespaceContext (or SimpleNamespaceContext) exposes thier internal map of the prefixes to
the namespaces.
|
void |
addNamespaces(OMElement element)
Add the namespace declarations of a given
OMElement to the namespace
context of an XPath expression. |
Map |
getNamespaces()
Expose the prefix to namespace mapping for this expression
|
booleanValueOf, createFunctionContext, createNamespaceContext, createVariableContext, debug, evaluate, getContext, getContextSupport, getFunctionContext, getNamespaceContext, getNavigator, getRootExpr, getVariableContext, numberValueOf, selectNodes, selectNodesForContext, selectSingleNode, selectSingleNodeForContext, setFunctionContext, setNamespaceContext, setVariableContext, stringValueOf, toString, valueOf
public AXIOMXPath(String xpathExpr) throws org.jaxen.JaxenException
xpathExpr
- the string representation of the XPath expression.org.jaxen.JaxenException
- if there is a syntax error while parsing the expressionpublic AXIOMXPath(OMElement element, String xpathExpr) throws org.jaxen.JaxenException
element
- The element that determines the namespace context of the
XPath expression. See addNamespaces(OMElement)
for more details.xpathExpr
- the string representation of the XPath expression.org.jaxen.JaxenException
- if there is a syntax error while parsing the expression
or if the namespace context could not be set uppublic AXIOMXPath(OMAttribute attribute) throws org.jaxen.JaxenException
attribute
- the attribute to construct the expression fromorg.jaxen.JaxenException
- if there is a syntax error while parsing the expression
or if the namespace context could not be set uppublic void addNamespace(String prefix, String uri) throws org.jaxen.JaxenException
addNamespace
in interface org.jaxen.XPath
addNamespace
in class org.jaxen.BaseXPath
prefix
- a namespace prefixuri
- the URI to which the prefix matchesorg.jaxen.JaxenException
- if the underlying implementation throws an exceptionpublic void addNamespaces(OMElement element) throws org.jaxen.JaxenException
OMElement
to the namespace
context of an XPath expression. Typically this method is used with an XPath
expression appearing in an attribute of the given element.
Note that the default namespace is explicitly excluded and not added to the namespace context. This makes the behaviour of this method consistent with the rules followed in XSL stylesheets. Indeed, the XSLT specification defines the namespace context of an XPath expression as follows:
the set of namespace declarations are those in scope on the element which has the attribute in which the expression occurs; [...] the default namespace (as declared by xmlns) is not part of this set
element
- the element to retrieve the namespace context fromorg.jaxen.JaxenException
- if an error occurred when adding the namespace declarationspublic Map getNamespaces()
Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.