public class XPathApiXPathEvaluator extends XPathEvaluator
XPathEvaluator
able to evaluate XPaths
as defined by XML Path
Language (XPath) Version 1.0.
This XPathEvaluator supports the the here()
function as defined
by XML-Signature
Syntax and Processing:
Function:
node-set here()
The here function returns a node-set containing the
attribute or processing instruction node or the parent element of the text
node that directly bears the XPath expression. This expression results in an
error if the containing XPath expression does not appear in the same XML
document against which the XPath expression is being evaluated.
Modifier and Type | Class and Description |
---|---|
static class |
XPathApiXPathEvaluator.XPathApiXPathEvaluatorRuntimeException
This class allows to catch this kind of
RuntimeException and to
wrap it into another Exception. |
additionalNSPrefixes_, cryptoContext_, hereNode_, hereResult_, timesum, XPATH_EXT_FUNC_NS_PREFIX, XPATH_EXT_FUNC_NS_URI
Constructor and Description |
---|
XPathApiXPathEvaluator(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 |
---|---|
Iterator |
evaluate(Node contextNode)
Evaluate XPath with the given node as context node.
|
boolean |
evaluateBoolean(Node contextNode)
Evaluate XPath with the given node as context node and convert the result
to a boolean.
|
newXPathEvaluator, newXPathEvaluator, prefixExtFunc
public XPathApiXPathEvaluator(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 Iterator evaluate(Node contextNode) throws XPathException
evaluate
in class XPathEvaluator
contextNode
- the context nodeNode
sXPathException
- if evaluating the XPath failspublic 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
evaluateBoolean
in class XPathEvaluator
contextNode
- the context nodeboolean()
function applied to the
result of evaluating the XPath expressionXPathException
- if evaluating the XPath fails© 2002-2005 IAIK, © 2004, 2006 - 2019 Stiftung SIC