|  | Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |

# QXmlResultItems Class Reference
[QtXmlPatterns module]

The QXmlResultItems class represents the items that are the result of an XQuery query. More...

     #include <QXmlResultItems>

Note: All the functions in this class are reentrant.

This class was introduced in Qt 4.4.

- List of all members, including inherited members

### Public Functions

- QXmlResultItems ()
- virtual ~QXmlResultItems ()
- QXmlItem current () const
- bool hasError () const
- QXmlItem next ()

## Detailed Description

The QXmlResultItems class represents the items that are the result of an XQuery query.

QXmlResultItems represent the items of a XQuery query, and allows them to be iterated like a forward iterator.

       QXmlQuery query;
       query.setQuery("<e/>, 1, 'two'");
       QXmlResultItems result;

       if(query.isValid())
       {
         query.evaluateToResult(&result);
         QXmlItem item(result.next())
         while(!item.isNull())
         {
             // Use item
             item = result.next();
         }

         if(result.hasError())
             return "Runtime error!";
       }

QXmlResultItems lazily evaluates the query as it is executed. One effect of this is that an error can occur. In that case hasError() will return `true`, and next() and current() returns a `null` QXmlItem.

QXmlResultItems can be seen as an iterator that advances over the sequence of items that a query produced. Each call to next() advances the QXmlResultItems instance to "point" to the next item in the sequence and returns it, and current() returns the item that next() returned the last time it was called.

See also QXmlItem::isNode(), QXmlItem::isAtomicValue(), and QXmlNodeModelIndex.

## Member Function Documentation

### QXmlResultItems::QXmlResultItems ()

Constructs a QXmlResultItems instance.

### QXmlResultItems::~QXmlResultItems () `[virtual]`

Destructs this QXmlResultItems instance.

### QXmlItem QXmlResultItems::current () const

Returns the current item.

On a default constructed QXmlResultItems instance, a `null` QXmlItem is returned.

### bool QXmlResultItems::hasError () const

If an error occurs during the evaluation, this function returns `true`.

By default `false` is returned.

### QXmlItem QXmlResultItems::next ()

On a default constructed QXmlResultItems instance, a `null` QXmlItem is returned.