|
|||||||||
| Home >> All >> org >> apache >> xpath >> [ domapi overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.xpath.domapi
Class XPathResultImpl

java.lang.Objectorg.apache.xpath.domapi.XPathResultImpl
- All Implemented Interfaces:
- org.w3c.dom.events.EventListener, org.w3c.dom.xpath.XPathResult
- public class XPathResultImpl
- extends java.lang.Object
- implements org.w3c.dom.xpath.XPathResult, org.w3c.dom.events.EventListener
- 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.
| Field Summary | |
private org.w3c.dom.Node |
m_contextNode
Only used to attach a mutation event handler when specified type is an iterator type. |
private boolean |
m_isInvalidIteratorState
|
private org.w3c.dom.traversal.NodeIterator |
m_iterator
The iterator, if this is an iterator type. |
private org.w3c.dom.NodeList |
m_list
The list, if this is a snapshot type. |
private org.apache.xpath.objects.XObject |
m_resultObj
The wrapped XObject |
private short |
m_resultType
This the type specified by the user during construction. |
| 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 |
| Constructor Summary | |
(package private) |
XPathResultImpl(short type,
org.apache.xpath.objects.XObject result,
org.w3c.dom.Node contextNode)
Constructor for XPathResultImpl. |
| 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. |
org.w3c.dom.Node |
getSingleNodeValue()
The value of this single node result, which may be null. |
int |
getSnapshotLength()
The number of nodes in the result snapshot. |
java.lang.String |
getStringValue()
The value of this string result. |
private short |
getTypeFromXObject(org.apache.xpath.objects.XObject object)
Given an XObject, determine the corresponding DOM XPath type |
java.lang.String |
getTypeString(int type)
Given a request type, return the equivalent string. |
void |
handleEvent(org.w3c.dom.events.Event event)
This method is called whenever an event occurs of the type for which the EventListener interface was registered. |
private boolean |
isNamespaceNode(org.w3c.dom.Node node)
Given a node, determine if it is a namespace node. |
static boolean |
isValidType(short type)
Check if the specified type is one of the supported types. |
org.w3c.dom.Node |
iterateNext()
Iterates and returns the next node from the node set or nullif there are no more nodes. |
org.w3c.dom.Node |
snapshotItem(int index)
Returns the indexth item in the snapshot collection. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
m_resultObj
private org.apache.xpath.objects.XObject m_resultObj
- The wrapped XObject
m_resultType
private short m_resultType
- This the type specified by the user during construction. Typically
the constructor will be called by org.apache.xpath.XPath.evaluate().
m_isInvalidIteratorState
private boolean m_isInvalidIteratorState
m_contextNode
private org.w3c.dom.Node m_contextNode
- Only used to attach a mutation event handler when specified
type is an iterator type.
m_iterator
private org.w3c.dom.traversal.NodeIterator m_iterator
- The iterator, if this is an iterator type.
m_list
private org.w3c.dom.NodeList m_list
- The list, if this is a snapshot type.
| Constructor Detail |
XPathResultImpl
XPathResultImpl(short type,
org.apache.xpath.objects.XObject result,
org.w3c.dom.Node contextNode)
- Constructor for XPathResultImpl.
For internal use only.
| Method Detail |
getResultType
public short getResultType()
- Description copied from interface:
org.w3c.dom.xpath.XPathResult - A code representing the type of this result, as defined by the type
constants.
- Specified by:
getResultTypein interfaceorg.w3c.dom.xpath.XPathResult
getNumberValue
public double getNumberValue()
throws org.w3c.dom.xpath.XPathException
- The value of this number result.
- Specified by:
getNumberValuein interfaceorg.w3c.dom.xpath.XPathResult
getStringValue
public java.lang.String getStringValue() throws org.w3c.dom.xpath.XPathException
- The value of this string result.
- Specified by:
getStringValuein interfaceorg.w3c.dom.xpath.XPathResult
getBooleanValue
public boolean getBooleanValue()
throws org.w3c.dom.xpath.XPathException
- Description copied from interface:
org.w3c.dom.xpath.XPathResult - The value of this boolean result.
- Specified by:
getBooleanValuein interfaceorg.w3c.dom.xpath.XPathResult
getSingleNodeValue
public org.w3c.dom.Node getSingleNodeValue() throws org.w3c.dom.xpath.XPathException
- The value of this single node result, which may be
null.- Specified by:
getSingleNodeValuein interfaceorg.w3c.dom.xpath.XPathResult
getInvalidIteratorState
public boolean getInvalidIteratorState()
- Description copied from interface:
org.w3c.dom.xpath.XPathResult - Signifies that the iterator has become invalid. True if
resultTypeisUNORDERED_NODE_ITERATOR_TYPEorORDERED_NODE_ITERATOR_TYPEand the document has been modified since this result was returned.- Specified by:
getInvalidIteratorStatein interfaceorg.w3c.dom.xpath.XPathResult
getSnapshotLength
public int getSnapshotLength()
throws org.w3c.dom.xpath.XPathException
- The number of nodes in the result snapshot. Valid values for
snapshotItem indices are
0tosnapshotLength-1inclusive.- Specified by:
getSnapshotLengthin interfaceorg.w3c.dom.xpath.XPathResult
iterateNext
public org.w3c.dom.Node iterateNext() throws org.w3c.dom.xpath.XPathException, org.w3c.dom.DOMException
- Iterates and returns the next node from the node set or
nullif there are no more nodes.- Specified by:
iterateNextin interfaceorg.w3c.dom.xpath.XPathResult
snapshotItem
public org.w3c.dom.Node snapshotItem(int index) throws org.w3c.dom.xpath.XPathException
- Returns the
indexth item in the snapshot collection. Ifindexis 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:
snapshotItemin interfaceorg.w3c.dom.xpath.XPathResult
isValidType
public static boolean isValidType(short type)
- Check if the specified type is one of the supported types.
handleEvent
public void handleEvent(org.w3c.dom.events.Event event)
- Description copied from interface:
org.w3c.dom.events.EventListener - This method is called whenever an event occurs of the type for which
the
EventListenerinterface was registered.- Specified by:
handleEventin interfaceorg.w3c.dom.events.EventListener
getTypeString
public java.lang.String getTypeString(int type)
- Given a request type, return the equivalent string.
For diagnostic purposes.
getTypeFromXObject
private short getTypeFromXObject(org.apache.xpath.objects.XObject object)
- Given an XObject, determine the corresponding DOM XPath type
isNamespaceNode
private boolean isNamespaceNode(org.w3c.dom.Node node)
- Given a node, determine if it is a namespace node.
|
|||||||||
| Home >> All >> org >> apache >> xpath >> [ domapi overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.xpath.domapi.XPathResultImpl