|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.xmlpatterns.QXmlResultItems
public class QXmlResultItems
The QXmlResultItems
class iterates through the results of evaluating an XQuery
in QXmlQuery
. QXmlResultItems
presents the evaluation of an associated query as a sequence of QXmlItems
. The sequence is traversed by repeatedly calling next()
, which actually produces the sequence by lazy evaluation of the query.
QXmlQuery query = new QXmlQuery(); query.setQuery("<e/>, 1, 'two'"); QXmlResultItems result = new QXmlResultItems(); if(query.isValid()) { query.evaluateToResult(result); QXmlItem item = result.next(); while(!item.isNull()) { // Use item item = result.next(); } if(result.hasError()) throw new RuntimeException("Runtime error!"); }An effect of letting
next()
produce the sequence by lazy evaluation is that a query error can occur on any call to next()
. If an error occurs, both next()
and current()
will return the null QXmlItem
, and hasError()
will return true. QXmlResultItems
can be thought of as an "iterator" that traverses the sequence of query results once, in the forward direction. Each call to next()
advances the iterator to the next QXmlItem
in the sequence and returns it, and current()
always returns the QXmlItem
that next()
returned the last time it was called.
QXmlItem::isNode()
, QXmlItem::isAtomicValue()
, and QXmlNodeModelIndex
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9 |
Constructor Summary | |
---|---|
QXmlResultItems()
Constructs an instance of QXmlResultItems . |
Method Summary | |
---|---|
QXmlItem |
current()
Returns the current item. |
static QXmlResultItems |
fromNativePointer(QNativePointer nativePointer)
|
boolean |
hasError()
If an error occurred during evaluation of the query, true is returned. |
QXmlItem |
next()
Returns the next result in the sequence produced by lazy evaluation of the associated query. |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class java.lang.Object |
---|
clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QXmlResultItems()
QXmlResultItems
.
Method Detail |
---|
public final QXmlItem current()
next()
. Returns a null QXmlItem
if there is no associated QXmlQuery
.
public final boolean hasError()
Returns false if query evaluation has been done.
public final QXmlItem next()
QXmlItem
is null, either the evaluation terminated normally without producing another result, or an error occurred. Call hasError()
to determine whether the null item was caused by normal termination or by an error. Returns a null QXmlItem
if there is no associated QXmlQuery
.
public static QXmlResultItems fromNativePointer(QNativePointer nativePointer)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |