|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.xpath.domapi.XPathResultImpl
The class provides an implementation XPathResult according to the DOM L3 XPath Specification, Working Draft 28, March 2002.
See also the Document Object Model (DOM) Level 3 XPath Specification.
The 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
Field 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 |
getBooleanValue()
The value of this boolean result. |
boolean |
getInvalidIteratorState()
Signifies that the iterator has become invalid. |
double |
getNumberValue()
The value of this number result. |
short |
getResultType()
A code representing the type of this result, as defined by the type constants. |
Node |
getSingleNodeValue()
The value of this single node result, which may be null . |
int |
getSnapshotLength()
The number of nodes in the result snapshot. |
String |
getStringValue()
The value of this string result. |
String |
getTypeString(int type)
Given a request type, return the equivalent string. |
void |
handleEvent(Event event)
This method is called whenever an event occurs of the type for which the EventListener interface was registered. |
static boolean |
isValidType(short type)
Check if the specified type is one of the supported types. |
Node |
iterateNext()
Iterates and returns the next node from the node set or null if there are no more nodes. |
Node |
snapshotItem(int index)
Returns the index th item in the snapshot collection. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public short getResultType()
XPathResult
getResultType
in interface XPathResult
XPathResult.getResultType()
public double getNumberValue() throws XPathException
getNumberValue
in interface XPathResult
XPathException
- TYPE_ERR: raised if resultType
is not
NUMBER_TYPE
.XPathResult.getNumberValue()
public String getStringValue() throws XPathException
getStringValue
in interface XPathResult
XPathException
- TYPE_ERR: raised if resultType
is not
STRING_TYPE
.XPathResult.getStringValue()
public boolean getBooleanValue() throws XPathException
XPathResult
getBooleanValue
in interface XPathResult
XPathException
- TYPE_ERR: raised if resultType
is not
BOOLEAN_TYPE
.XPathResult.getBooleanValue()
public Node getSingleNodeValue() throws XPathException
null
.
getSingleNodeValue
in interface XPathResult
XPathException
- TYPE_ERR: raised if resultType
is not
ANY_UNORDERED_NODE_TYPE
or
FIRST_ORDERED_NODE_TYPE
.XPathResult.getSingleNodeValue()
public boolean getInvalidIteratorState()
XPathResult
resultType
is UNORDERED_NODE_ITERATOR_TYPE
or ORDERED_NODE_ITERATOR_TYPE
and the document has been
modified since this result was returned.
getInvalidIteratorState
in interface XPathResult
XPathResult.getInvalidIteratorState()
public int getSnapshotLength() throws XPathException
0
to
snapshotLength-1
inclusive.
getSnapshotLength
in interface XPathResult
XPathException
- TYPE_ERR: raised if resultType
is not
UNORDERED_NODE_SNAPSHOT_TYPE
or
ORDERED_NODE_SNAPSHOT_TYPE
.XPathResult.getSnapshotLength()
public Node iterateNext() throws XPathException, DOMException
null
if there are no more nodes.
iterateNext
in interface XPathResult
XPathException
- TYPE_ERR: raised if resultType
is not
UNORDERED_NODE_ITERATOR_TYPE
or
ORDERED_NODE_ITERATOR_TYPE
.
DOMException
- INVALID_STATE_ERR: The document has been mutated since the result was
returned.XPathResult.iterateNext()
public Node snapshotItem(int index) throws XPathException
index
th item in the snapshot collection. If
index
is greater than or equal to the number of nodes in
the list, this method returns null
. Unlike the iterator
result, the snapshot does not become invalid, but may not correspond
to the current document if it is mutated.
snapshotItem
in interface XPathResult
index
- Index into the snapshot collection.
index
th position in the
NodeList
, or null
if that is not a valid
index.
XPathException
- TYPE_ERR: raised if resultType
is not
UNORDERED_NODE_SNAPSHOT_TYPE
or
ORDERED_NODE_SNAPSHOT_TYPE
.XPathResult.snapshotItem(int)
public static boolean isValidType(short type)
type
- The specified type
public void handleEvent(Event event)
EventListener
EventListener
interface was registered.
handleEvent
in interface EventListener
event
- The Event
contains contextual information
about the event. It also contains the stopPropagation
and preventDefault
methods which are used in
determining the event's flow and default action.EventListener.handleEvent(Event)
public String getTypeString(int type)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |