public abstract class XPathEvaluator extends Object
XPathEvaluator
able to evaluate XPaths
as defined by XML Path
Language (XPath) Version 1.0.
here()
function as defined
by XML-Signature
Syntax and Processing:
Modifier and Type | Field and Description |
---|---|
protected HashMap |
additionalNSPrefixes_ |
protected DOMCryptoContext |
cryptoContext_
The
DOMCryptoContext to look up Id-attributes. |
protected Node |
hereNode_
This field stores the owner of the XPath expression.
|
protected NodeList |
hereResult_
Result of the here() extension function.
|
protected static long |
timesum |
protected static String |
XPATH_EXT_FUNC_NS_PREFIX
Prefix of the XPath extension function namespace.
|
protected static String |
XPATH_EXT_FUNC_NS_URI
URI of the XPath extension function namespace.
|
Constructor and Description |
---|
XPathEvaluator(String xpathExpr,
Node ownerNode,
Map additionalNSPrefixes,
DOMCryptoContext cryptoContext)
Creates a new
XPathEvaluator using the given XPath expression,
the given ownerNode as node returned by the
here() function and as namespace context node and the
additonaNSPrefixes Map ping. |
Modifier and Type | Method and Description |
---|---|
abstract Iterator |
evaluate(Node contextNode)
Evaluate XPath with the given node as context node.
|
abstract boolean |
evaluateBoolean(Node contextNode)
Evaluate XPath with the given node as context node and convert the result
to a boolean.
|
static org.w3c.dom.xpath.XPathEvaluator |
newXPathEvaluator(DOMImplementation domImplementation) |
static XPathEvaluator |
newXPathEvaluator(String singleXPath,
Node here,
Map xmlNSdeclarations,
DOMCryptoContext context) |
protected String |
prefixExtFunc(String xpathExpr,
String func) |
protected static long timesum
protected static final String XPATH_EXT_FUNC_NS_PREFIX
protected static final String XPATH_EXT_FUNC_NS_URI
protected HashMap additionalNSPrefixes_
protected Node hereNode_
protected DOMCryptoContext cryptoContext_
DOMCryptoContext
to look up Id-attributes.protected NodeList hereResult_
public XPathEvaluator(String xpathExpr, Node ownerNode, Map additionalNSPrefixes, DOMCryptoContext cryptoContext) throws XPathException
XPathEvaluator
using the given XPath expression,
the given ownerNode
as node returned by the
here()
function and as namespace context node and the
additonaNSPrefixes
Map
ping.xpathExpr
- the XPath expressionownerNode
- the node returned by the here()
function and used as
namespace context nodeadditionalNSPrefixes
- a Map
from namespace prefixes (String
) to namespace
URI (String
)cryptoContext
- the context that holds the xsd:Id
attribute mapping
(may be null
)XPathException
- if setting up the XPath context fails, e.g. the provided XPath
expression couldn't be evaluatedpublic static XPathEvaluator newXPathEvaluator(String singleXPath, Node here, Map xmlNSdeclarations, DOMCryptoContext context) throws IllegalArgumentException, XPathException
public abstract Iterator evaluate(Node contextNode) throws XPathException
contextNode
- the context nodeNode
sXPathException
- if evaluating the XPath failspublic abstract boolean evaluateBoolean(Node contextNode) throws XPathException
Function: boolean boolean(object)
The boolean function converts its argument to a boolean as follows:
a number is true if and only if it is neither positive or negative zero nor NaN
a node-set is true if and only if it is non-empty
a string is true if and only if its length is non-zero
an object of a type other than the four basic types is converted to a boolean in a way that is dependent on that type
contextNode
- the context nodeboolean()
function applied to the
result of evaluating the XPath expressionXPathException
- if evaluating the XPath failspublic static org.w3c.dom.xpath.XPathEvaluator newXPathEvaluator(DOMImplementation domImplementation) throws XPathException
XPathException
© 2002-2005 IAIK, © 2004, 2006 - 2019 Stiftung SIC