public interface XPathResult
Modifier and Type | Method and Description |
---|---|
boolean |
asBoolean()
Returns the XPath result represented as a boolean.
|
double |
asNumber()
Returns the XPath result represented as a number.
|
java.util.Optional<Node> |
asSingleNode()
Returns an
Optional that contains the XPath result represented as a single node or an
empty Optional if it does not exist. |
java.util.List<Node> |
asSnapshotNodes()
Returns the XPath result represented as an immutable list of the snapshot nodes.
|
java.lang.String |
asString()
Returns the XPath result represented as a string.
|
boolean |
isBoolean()
Returns
true if the result type is XPathResultType.BOOLEAN . |
boolean |
isIterator()
Returns
true if the result type is XPathResultType.UNORDERED_NODE_ITERATOR or
XPathResultType.ORDERED_NODE_ITERATOR . |
boolean |
isNumber()
Returns
true if the result type is XPathResultType.NUMBER . |
boolean |
isSingleNode()
Returns
true if the result type is XPathResultType.FIRST_ORDERED_NODE or
XPathResultType.ANY_UNORDERED_NODE . |
boolean |
isSnapshotNodes()
Returns
true if the result type is XPathResultType.ORDERED_NODE_SNAPSHOT or
XPathResultType.UNORDERED_NODE_SNAPSHOT . |
boolean |
isString()
Returns
true if the result type is XPathResultType.STRING . |
java.util.Optional<Node> |
iterateNext()
Moves the iterator to the next node in the result set and returns an
Optional that
contains the Node object referenced by the current iterator. |
XPathResultType |
type()
Returns the result type.
|
XPathResultType type()
double asNumber()
XPathException
- if the result is not of a number type (see isNumber()
)ObjectClosedException
- when the document this instance belongs to is closedboolean isNumber()
true
if the result type is XPathResultType.NUMBER
.java.lang.String asString()
XPathException
- if the result is not of a string type (see isString()
)ObjectClosedException
- when the document this instance belongs to is closedboolean isString()
true
if the result type is XPathResultType.STRING
.boolean asBoolean()
XPathException
- if the result is not of a boolean type (see isBoolean()
)ObjectClosedException
- when the document this instance belongs to is closedboolean isBoolean()
true
if the result type is XPathResultType.BOOLEAN
.java.util.Optional<Node> asSingleNode()
Optional
that contains the XPath result represented as a single node or an
empty Optional
if it does not exist.XPathException
- if the result is not of a single node type (see isSingleNode()
)ObjectClosedException
- when the document this instance belongs to is closedboolean isSingleNode()
true
if the result type is XPathResultType.FIRST_ORDERED_NODE
or
XPathResultType.ANY_UNORDERED_NODE
.java.util.Optional<Node> iterateNext()
Optional
that
contains the Node
object referenced by the current iterator. When iteration is over,
returns an empty Optional
.XPathException
- if the current result is not of an iterator type (see isIterator()
)ObjectClosedException
- when the document this instance belongs to is closedboolean isIterator()
true
if the result type is XPathResultType.UNORDERED_NODE_ITERATOR
or
XPathResultType.ORDERED_NODE_ITERATOR
.java.util.List<Node> asSnapshotNodes()
XPathException
- if the current result is not of a list of the snapshot nodes
(see isSnapshotNodes()
)ObjectClosedException
- when the document this instance belongs to is closedboolean isSnapshotNodes()
true
if the result type is XPathResultType.ORDERED_NODE_SNAPSHOT
or
XPathResultType.UNORDERED_NODE_SNAPSHOT
.