org.apache.xpath.domapi
Class XPathResultImpl
java.lang.Object
org.apache.xpath.domapi.XPathResultImpl
- XPathResult, EventListener
public class XPathResultImpl
extends java.lang.Object
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
, org.w3c.dom.xpath.XPathResult
getBooleanValue
public boolean getBooleanValue()
throws XPathException
org.w3c.dom.xpath.XPathResult.getBooleanValue()
getInvalidIteratorState
public boolean getInvalidIteratorState()
org.w3c.dom.xpath.XPathResult.getInvalidIteratorState()
getNumberValue
public double getNumberValue()
throws XPathException
The value of this number result.
org.w3c.dom.xpath.XPathResult.getNumberValue()
getResultType
public short getResultType()
org.w3c.dom.xpath.XPathResult.getResultType()
getSingleNodeValue
public Node getSingleNodeValue()
throws XPathException
The value of this single node result, which may be null
.
org.w3c.dom.xpath.XPathResult.getSingleNodeValue()
getSnapshotLength
public int getSnapshotLength()
throws XPathException
The number of nodes in the result snapshot. Valid values for
snapshotItem indices are 0
to
snapshotLength-1
inclusive.
org.w3c.dom.xpath.XPathResult.getSnapshotLength()
getStringValue
public String getStringValue()
throws XPathException
The value of this string result.
org.w3c.dom.xpath.XPathResult.getStringValue()
getTypeString
public String getTypeString(int type)
Given a request type, return the equivalent string.
For diagnostic purposes.
- type string
isValidType
public static boolean isValidType(short type)
Check if the specified type is one of the supported types.
type
- The specified type
- true If the specified type is supported; otherwise, returns false.
iterateNext
public Node iterateNext()
throws XPathException,
DOMException
Iterates and returns the next node from the node set or
null
if there are no more nodes.
- Returns the next node.
DOMException
- INVALID_STATE_ERR: The document has been mutated since the result was
returned.
org.w3c.dom.xpath.XPathResult.iterateNext()
snapshotItem
public Node snapshotItem(int index)
throws XPathException
Returns the 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.
index
- Index into the snapshot collection.
- The node at the
index
th position in the
NodeList
, or null
if that is not a valid
index.
org.w3c.dom.xpath.XPathResult.snapshotItem(int)
Copyright B) 2004 Apache XML Project. All Rights Reserved.