# XPath2Result Class Reference

The XPathResult2 interface represents the result of the evaluation of an XPath 2.0 expression within the context of a particular node. More...

`#include <XPath2Result.hpp>`

List of all members.

## Public Types

Public Constants
enum | ResultType { FIRST_RESULT = 100, ITERATOR_RESULT = 101, SNAPSHOT_RESULT = 102 }

## Public Member Functions

Destructor
virtual | ~XPath2Result ()
| Destructor.
Functions introduced in DOM Level 3
virtual ResultType | getResultType () const =0
| Returns the result type of this result.
virtual bool | isNode () const =0
| Returns true if the result has a current result and the value is a node.
virtual const xercesc::DOMTypeInfo * | getTypeInfo () const =0
| Returns the DOM type info of the current result node or value.
virtual double | asDouble () const =0
| Conversion of the current result to double.
virtual int | asInt () const =0
| Conversion of the current result to int.
virtual const XMLCh * | asString () const =0
| Conversion of the current result to string.
virtual bool | asBoolean () const =0
| Conversion of the current result to boolean.
virtual const xercesc::DOMNode * | asNode () const =0
| Retrieve the current node value.
virtual bool | getInvalidIteratorState () const =0
| Signifies that the iterator has become invalid.
virtual unsigned long | getSnapshotLength () const =0
| The number of items in the result snapshot.
virtual bool | iterateNext ()=0
| Iterates and returns true if the current result is the next item from the sequence or false if there are no more items.
virtual bool | snapshotItem (unsigned long index)=0
| Sets the current result to the indexth item in the snapshot collection.
Non-standard Extension
virtual void | release ()=0
| Called to indicate that this object (and its associated children) is no longer in use and that the implementation may relinquish any resources associated with it and its associated children.

## Protected Member Functions

Hidden constructors
| XPath2Result ()

## Detailed Description

The XPathResult2 interface represents the result of the evaluation of an XPath 2.0 expression within the context of a particular node.

Since evaluation of an XPath 2.0 expression can result in various result types, this object makes it possible to discover and manipulate the type and value of the result.

Since:
  DOM Level 3

## Member Enumeration Documentation

enum XPath2Result::ResultType

FIRST_RESULT
The result is a sequence as defined by XPath 2.0 and will be accessed as a single current value or there will be no current value if the sequence is empty. Document modification does not invalidate the value, but may mean that the result no longer corresponds to the current document. This is a convenience that permits optimization since the implementation can stop once the first item in the resulting sequence has been found. If there is more than one item in the actual result, the single item returned might not be the first in document order.

ITERATOR_RESULT
The result is a sequence as defined by XPath 2.0 that will be accessed iteratively. Document modification invalidates the iteration.

SNAPSHOT_RESULT
The result is a sequence as defined by XPath 2.0 that will be accessed as a snapshot list of values. Document modification does not invalidate the snapshot but may mean that reevaluation would not yield the same snapshot and any items in the snapshot may have been altered, moved, or removed from the document.

Enumerator:

  FIRST_RESULT |
  ITERATOR_RESULT |
  SNAPSHOT_RESULT |

## Constructor & Destructor Documentation

virtual XPath2Result::~XPath2Result | ( |  | ) | `[inline, virtual]`

| Destructor.

XPath2Result::XPath2Result | ( |  | ) | `[inline, protected]`

## Member Function Documentation

virtual bool XPath2Result::asBoolean | ( |  | ) | const`[pure virtual]`

Conversion of the current result to boolean.

Returns:
  asBoolean of type boolean, readonly

Exceptions:

  | XPathException | TYPE_ERR: raised if cannot be properly converted to boolean.
  | DOMException | INVALID_STATE_ERR: There is no current result in the result.

virtual double XPath2Result::asDouble | ( |  | ) | const`[pure virtual]`

Conversion of the current result to double.

If the native double type of the DOM binding does not directly support the exact IEEE 754 result of the XPath expression, then it is up to the definition of the binding to specify how the XPath number is converted to the native binding number.

Returns:
  asDouble of type double, readonly

Exceptions:

  | XPathException | TYPE_ERR: raised if current result cannot be properly converted to double.
  | DOMException | INVALID_STATE_ERR: There is no current result in the result.

virtual int XPath2Result::asInt | ( |  | ) | const`[pure virtual]`

Conversion of the current result to int.

Returns:
  asInt of type int, readonly

Exceptions:

  | XPathException | TYPE_ERR: raised if current result cannot be properly converted to int.
  | DOMException | INVALID_STATE_ERR: There is no current result in the result.

virtual const xercesc:: DOMNode* XPath2Result::asNode | ( |  | ) | const`[pure virtual]`

Retrieve the current node value.

Returns:
  asNode of type Node, readonly

Exceptions:

  | XPathException | TYPE_ERR: raised if current result is not a node.
  | DOMException | INVALID_STATE_ERR: There is no current result in the result.

virtual const XMLCh* XPath2Result::asString | ( |  | ) | const`[pure virtual]`

Conversion of the current result to string.

Returns:
  asString of type DOMString, readonly

Exceptions:

  | XPathException | TYPE_ERR: raised if current result cannot be properly converted to string.
  | DOMException | INVALID_STATE_ERR: There is no current result in the result.

virtual bool XPath2Result::getInvalidIteratorState | ( |  | ) | const`[pure virtual]`

Signifies that the iterator has become invalid.

Returns:
  invalidIteratorState of type boolean, readonly

virtual ResultType XPath2Result::getResultType | ( |  | ) | const`[pure virtual]`

Returns the result type of this result.

Returns:
  ResultType A code representing the type of this result, as defined by the type constants.

virtual unsigned long XPath2Result::getSnapshotLength | ( |  | ) | const`[pure virtual]`

The number of items in the result snapshot.

Valid values for snapshotItem indices are 0 to snapshotLength-1 inclusive.

Returns:
  snapshotLength of type unsigned long, readonly

Exceptions:

  | XPathException | TYPE_ERR: raised if resultType is not SNAPSHOT_RESULT.

virtual const xercesc:: DOMTypeInfo* XPath2Result::getTypeInfo | ( |  | ) | const`[pure virtual]`

Returns the DOM type info of the current result node or value.

Returns:
  typeInfo of type TypeInfo, readonly

virtual bool XPath2Result::isNode | ( |  | ) | const`[pure virtual]`

Returns true if the result has a current result and the value is a node.

Returns:
  isNode of type boolean, readonly

virtual bool XPath2Result::iterateNext | ( |  | ) | `[pure virtual]`

Iterates and returns true if the current result is the next item from the sequence or false if there are no more items.

Returns:
  boolean True if the current result is the next item from the sequence or false if there are no more items.

Exceptions:

  | XPathException | TYPE_ERR: raised if resultType is not ITERATOR_RESULT.
  | DOMException | INVALID_STATE_ERR: The document has been mutated since the result was returned.

virtual void XPath2Result::release | ( |  | ) | `[pure virtual]`

| Called to indicate that this object (and its associated children) is no longer in use and that the implementation may relinquish any resources associated with it and its associated children. Access to a released object will lead to unexpected result.

virtual bool XPath2Result::snapshotItem | ( | unsigned long | index | ) | `[pure virtual]`

Sets the current result to the indexth item in the snapshot collection.

If index is greater than or equal to the number of items in the list, this method returns false. Unlike the iterator result, the snapshot does not become invalid, but may not correspond to the current document if it is mutated.

Parameters:

  | index | of type unsigned long - Index into the snapshot collection.

Returns:
  boolean True if the current result is the next item from the sequence or false if there are no more items.

Exceptions:

  | XPathException | TYPE_ERR: raised if resultType is not SNAPSHOT_RESULT.

The documentation for this class was generated from the following file:

- XPath2Result.hpp