Package com.teamdev.jxbrowser.dom
Interface XPathResult
public interface XPathResult
An implementation of the DOM W3C XPathResult
interface that represents the result of the XPath expression evaluation.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns the XPath result represented as a boolean.double
asNumber()
Returns the XPath result represented as a number.Returns anOptional
that contains the XPath result represented as a single node or an emptyOptional
if it does not exist.Returns the XPath result represented as an immutable list of the snapshot nodes.asString()
Returns the XPath result represented as a string.boolean
Returnstrue
if the result type isXPathResultType.BOOLEAN
.boolean
Returnstrue
if the result type isXPathResultType.UNORDERED_NODE_ITERATOR
orXPathResultType.ORDERED_NODE_ITERATOR
.boolean
isNumber()
Returnstrue
if the result type isXPathResultType.NUMBER
.boolean
Returnstrue
if the result type isXPathResultType.FIRST_ORDERED_NODE
orXPathResultType.ANY_UNORDERED_NODE
.boolean
Returnstrue
if the result type isXPathResultType.ORDERED_NODE_SNAPSHOT
orXPathResultType.UNORDERED_NODE_SNAPSHOT
.boolean
isString()
Returnstrue
if the result type isXPathResultType.STRING
.type()
Returns the result type.
-
Method Details
-
type
XPathResultType type()Returns the result type. -
asNumber
double asNumber()Returns the XPath result represented as a number.- Throws:
XPathException
- if the result is not of a number type (seeisNumber()
)ObjectClosedException
- when the document this instance belongs to is closed
-
isNumber
boolean isNumber()Returnstrue
if the result type isXPathResultType.NUMBER
. -
asString
String asString()Returns the XPath result represented as a string.- Throws:
XPathException
- if the result is not of a string type (seeisString()
)ObjectClosedException
- when the document this instance belongs to is closed
-
isString
boolean isString()Returnstrue
if the result type isXPathResultType.STRING
. -
asBoolean
boolean asBoolean()Returns the XPath result represented as a boolean.- Throws:
XPathException
- if the result is not of a boolean type (seeisBoolean()
)ObjectClosedException
- when the document this instance belongs to is closed
-
isBoolean
boolean isBoolean()Returnstrue
if the result type isXPathResultType.BOOLEAN
. -
asSingleNode
Returns anOptional
that contains the XPath result represented as a single node or an emptyOptional
if it does not exist.- Throws:
XPathException
- if the result is not of a single node type (seeisSingleNode()
)ObjectClosedException
- when the document this instance belongs to is closed
-
isSingleNode
boolean isSingleNode()Returnstrue
if the result type isXPathResultType.FIRST_ORDERED_NODE
orXPathResultType.ANY_UNORDERED_NODE
. -
iterateNext
Moves the iterator to the next node in the result set and returns anOptional
that contains theNode
object referenced by the current iterator. When iteration is over, returns an emptyOptional
.- Throws:
XPathException
- if the current result is not of an iterator type (seeisIterator()
)ObjectClosedException
- when the document this instance belongs to is closed
-
isIterator
boolean isIterator()Returnstrue
if the result type isXPathResultType.UNORDERED_NODE_ITERATOR
orXPathResultType.ORDERED_NODE_ITERATOR
. -
asSnapshotNodes
Returns the XPath result represented as an immutable list of the snapshot nodes.- Throws:
XPathException
- if the current result is not of a list of the snapshot nodes (seeisSnapshotNodes()
)ObjectClosedException
- when the document this instance belongs to is closed
-
isSnapshotNodes
boolean isSnapshotNodes()Returnstrue
if the result type isXPathResultType.ORDERED_NODE_SNAPSHOT
orXPathResultType.UNORDERED_NODE_SNAPSHOT
.
-