Home · All Classes · Modules

QXmlItem Class Reference
[QtXmlPatterns module]

The QXmlItem class represents an item in XQuery and XPath, which is either a node or an atomic value. More...

Methods


Detailed Description

The QXmlItem class represents an item in XQuery and XPath, which is either a node or an atomic value.

In XQuery, all expressions evaluate to a sequence of items, where each item is an atomic value or a XML node. For instance, this query:

 <aNode/>,
 xs:base64Binary("FFFF"),
 current-date(),
 3e3, (: A floating point value :)
 attribute {"name"} {()}

evaluate to a sequence of five items: an element, an atomic value which is binary data encoded in base64, a date, a float, and an attribute node.

QXmlItem is the class that represents XQuery items in the Qt API. It is always either a node or an item, which isNode() and isAtomicValue() tells. Atomic values are represented in Qt using QVariant, and a QXmlitem can be converted to one by calling toAtomicValue(). Similarly, nodes are represented with QXmlNodeModelIndex, and those can be retrieved by calling toNodeModelIndex().

A default constructed QXmlItem instance is neither a node or an atomic value, it is null, as isNull() tells.

QXmlItem instances will dangle if the model that QXmlNodeModelIndex instances refers to is deleted.


Method Documentation

QXmlItem.__init__ (self)

Construct a null QXmlItem, which is neither a node nor an atomic value.

For a default constructed QXmlItem, isNull() returns true.

QXmlItem.__init__ (self, QXmlItem other)

Constructs a QXmlItem instance that is a copy of other.

QXmlItem.__init__ (self, QXmlNodeModelIndex node)

Constructs a QXmlItem instance that is a copy of node. This item will subsequently be a node.

See also QXmlItem.isNode().

QXmlItem.__init__ (self, QVariant atomicValue)

Constructs a QXmlItem that is the atomic value atomicValue.

bool QXmlItem.isAtomicValue (self)

Returns true if this item is an atomic value, otherwise false.

If this item is null, false is returned.

See also isNull() and isNode().

bool QXmlItem.isNode (self)

Returns true if this item is a Node, otherwise false.

If this item is null, false is returned.

See also isNull() and isAtomicValue().

bool QXmlItem.isNull (self)

Returns true if this QXmlItem instance do not represent an item.

QVariant QXmlItem.toAtomicValue (self)

Considers this item an atomic value, and returns it in the form of a QVariant instance.

If this QXmlItem is not an atomic value, the return value is a default constructed QVariant.

See also isAtomicValue().

QXmlNodeModelIndex QXmlItem.toNodeModelIndex (self)

Considers this item an node, and returns it in the form of a QXmlNodeModelIndex instance.

If this QXmlItem is not a node, the return value is undefined.

See also isNode().


PyQt 4.4.2 for X11Copyright © Riverbank Computing Ltd and Trolltech AS 2008Qt 4.4.0