Package com.metreeca.xml.actions
Class XPath.Processor
java.lang.Object
com.metreeca.xml.actions.XPath.Processor
XPath processor.
Applies XPath expression to a target XML node.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionRetrieves a boolean value from the target node.document()
Retrieves the target document.Retrieves an element value from the target node.Retrieves element values from the target node.Retrieves a URI value from the target node.Retrieves URI values from the target node.node()
Retrieves the target node.Retrieves a node value from the target node.Retrieves node values from the target node.Retrieves a numeric value from the target node.Retrieves a textual value from the target node.Retrieves textual values from the target node.
-
Constructor Details
-
Processor
Creates an XPath processor.- Parameters:
node
- the target XML node for the processor- Throws:
NullPointerException
- ifnode
is null
-
-
Method Details
-
node
Retrieves the target node.- Returns:
- the target node of this processor.
-
document
Retrieves the target document.- Returns:
- the target document of this processor.
-
bool
Retrieves a boolean value from the target node.- Parameters:
xpath
- the XPath expression to be evaluated against the target node- Returns:
- an optional boolean containing the value produced by evaluating
xpath
against the target node - Throws:
NullPointerException
- ifxpath
is null
-
number
Retrieves a numeric value from the target node.- Parameters:
xpath
- the XPath expression to be evaluated against the target node- Returns:
- an optional number containing the value produced by evaluating
xpath
against the target node, if one was available; an empty optional, otherwise - Throws:
NullPointerException
- ifxpath
is null
-
string
Retrieves a textual value from the target node.- Parameters:
xpath
- the XPath expression to be evaluated against the target node- Returns:
- an optional non-empty string containing the value produced by evaluating
xpath
against the target node, if one was available and not empty; an empty optional, otherwise - Throws:
NullPointerException
- ifxpath
is null
-
strings
Retrieves textual values from the target node.- Parameters:
xpath
- the XPath expression to be evaluated against the target node- Returns:
- a stream of non-empty strings containing the values produced by evaluating
xpath
against the target node - Throws:
NullPointerException
- ifxpath
is null
-
link
Retrieves a URI value from the target node.- Parameters:
xpath
- the XPath expression to be evaluated against the target node- Returns:
- an optional string URIs containing the values produced by evaluating
xpath
against the target node, if one was available, and resolving it against the base URI of the target node, if available; syntactically malformed URIs are returned verbatim - Throws:
NullPointerException
- ifxpath
is null
-
links
Retrieves URI values from the target node.- Parameters:
xpath
- the XPath expression to be evaluated against the target node- Returns:
- a stream of URIs containing the values produced by evaluating
xpath
against the target node and resolving them against the base URI of the target node, if available; syntactically malformed URIs are returned verbatim - Throws:
NullPointerException
- ifxpath
is null
-
element
Retrieves an element value from the target node.- Parameters:
xpath
- the XPath expression to be evaluated against the target node- Returns:
- an optional element containing the value produced by evaluating
xpath
against the target node, if one was available; an empty optional, otherwise - Throws:
NullPointerException
- ifxpath
is null
-
elements
Retrieves element values from the target node.- Parameters:
xpath
- the XPath expression to be evaluated against the target node- Returns:
- a stream of elements containing the values produced by evaluating
xpath
against the target node - Throws:
NullPointerException
- ifxpath
is null
-
node
Retrieves a node value from the target node.- Parameters:
xpath
- the XPath expression to be evaluated against the target node- Returns:
- an optional node containing the value produced by evaluating
xpath
against the target node, if one was available; an empty optional, otherwise - Throws:
NullPointerException
- ifxpath
is null
-
nodes
Retrieves node values from the target node.- Parameters:
xpath
- the XPath expression to be evaluated against the target node- Returns:
- a stream of nodes containing the values produced by evaluating
xpath
against the target node - Throws:
NullPointerException
- ifxpath
is null
-