Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.xpath.domapi.XPathResultImpl
XPathResult
interface represents the result of the
evaluation of an XPath expression within the context of a particular
node. Since evaluation of an XPath expression can result in various
result types, this object makes it possible to discover and manipulate
the type and value of the result.
This implementation wraps an XObject
.
XObject
, XPathResult
Nested Class Summary |
Fields inherited from interface org.w3c.dom.xpath.XPathResult | |
ANY_TYPE , ANY_UNORDERED_NODE_TYPE , BOOLEAN_TYPE , FIRST_ORDERED_NODE_TYPE , NUMBER_TYPE , ORDERED_NODE_ITERATOR_TYPE , ORDERED_NODE_SNAPSHOT_TYPE , STRING_TYPE , UNORDERED_NODE_ITERATOR_TYPE , UNORDERED_NODE_SNAPSHOT_TYPE |
Method Summary | |
boolean | |
boolean | |
double |
|
short | |
Node |
|
int |
|
String |
|
String |
|
void |
|
static boolean |
|
Node |
|
Node |
|
public boolean getBooleanValue() throws XPathException
- Specified by:
- getBooleanValue in interface XPathResult
- See Also:
XPathResult.getBooleanValue()
public boolean getInvalidIteratorState()
- Specified by:
- getInvalidIteratorState in interface XPathResult
public double getNumberValue() throws XPathException
The value of this number result.
- Specified by:
- getNumberValue in interface XPathResult
- Throws:
XPathException
- TYPE_ERR: raised ifresultType
is notNUMBER_TYPE
.
- See Also:
XPathResult.getNumberValue()
public short getResultType()
- Specified by:
- getResultType in interface XPathResult
- See Also:
XPathResult.getResultType()
public Node getSingleNodeValue() throws XPathException
The value of this single node result, which may benull
.
- Specified by:
- getSingleNodeValue in interface XPathResult
- Throws:
XPathException
- TYPE_ERR: raised ifresultType
is notANY_UNORDERED_NODE_TYPE
orFIRST_ORDERED_NODE_TYPE
.
- See Also:
XPathResult.getSingleNodeValue()
public int getSnapshotLength() throws XPathException
The number of nodes in the result snapshot. Valid values for snapshotItem indices are0
tosnapshotLength-1
inclusive.
- Specified by:
- getSnapshotLength in interface XPathResult
- Throws:
XPathException
- TYPE_ERR: raised ifresultType
is notUNORDERED_NODE_SNAPSHOT_TYPE
orORDERED_NODE_SNAPSHOT_TYPE
.
- See Also:
XPathResult.getSnapshotLength()
public String getStringValue() throws XPathException
The value of this string result.
- Specified by:
- getStringValue in interface XPathResult
- Throws:
XPathException
- TYPE_ERR: raised ifresultType
is notSTRING_TYPE
.
- See Also:
XPathResult.getStringValue()
public String getTypeString(int type)
Given a request type, return the equivalent string. For diagnostic purposes.
- Returns:
- type string
public void handleEvent(Event event)
- Specified by:
- handleEvent in interface EventListener
- See Also:
EventListener.handleEvent(Event)
public static boolean isValidType(short type)
Check if the specified type is one of the supported types.
- Parameters:
type
- The specified type
- Returns:
- true If the specified type is supported; otherwise, returns false.
public Node iterateNext() throws XPathException, DOMException
Iterates and returns the next node from the node set ornull
if there are no more nodes.
- Specified by:
- iterateNext in interface XPathResult
- Returns:
- Returns the next node.
- Throws:
XPathException
- TYPE_ERR: raised ifresultType
is notUNORDERED_NODE_ITERATOR_TYPE
orORDERED_NODE_ITERATOR_TYPE
.DOMException
- INVALID_STATE_ERR: The document has been mutated since the result was returned.
- See Also:
XPathResult.iterateNext()
public Node snapshotItem(int index) throws XPathException
Returns theindex
th item in the snapshot collection. Ifindex
is greater than or equal to the number of nodes in the list, this method returnsnull
. Unlike the iterator result, the snapshot does not become invalid, but may not correspond to the current document if it is mutated.
- Specified by:
- snapshotItem in interface XPathResult
- Parameters:
index
- Index into the snapshot collection.
- Returns:
- The node at the
index
th position in theNodeList
, ornull
if that is not a valid index.
- Throws:
XPathException
- TYPE_ERR: raised ifresultType
is notUNORDERED_NODE_SNAPSHOT_TYPE
orORDERED_NODE_SNAPSHOT_TYPE
.
- See Also:
XPathResult.snapshotItem(int)