Home · All Classes · Modules

QSimpleXmlNodeModel Class Reference
[QtXmlPatterns module]

The QSimpleXmlNodeModel class provides a simple yet powerful way of implementing QAbstractXmlNodeModel. More...

Inherits QAbstractXmlNodeModel.

Methods


Detailed Description

The QSimpleXmlNodeModel class provides a simple yet powerful way of implementing QAbstractXmlNodeModel.

Since QAbstractXmlNodeModel.iterate() requires a sub-class of QAbstractXmlForwardIterator to be returned for each axis, it can be a bit time consuming to implement. For that reason QSimpleXmlNodeModel exists which has nextFromSimpleAxis(), that that is a quick but often sufficient way of providing the node navigation. Behind the scenes QSimpleXmlNodeModel.iterate() "emulates" the full XPath axes using nextFromSimpleAxis().

Apart from nextFromSimpleAxis(), QSimpleXmlNodeModel provides default implementations for many of the members in QAbstractXmlNodeModel that are suitable for a wide range of scenarios.

Sub-classes of QSimpleXmlNodeModel must be thread-safe, just like sub-classes other sub-classes of QAbstractXmlNodeModel.


Method Documentation

QSimpleXmlNodeModel.__init__ (self, QXmlNamePool namePool)

Constructs a QSimpleXmlNodeModel instance that can be used with the name pool namePool. It can subsequently be accessed with namePool().

QUrl QSimpleXmlNodeModel.baseUri (self, QXmlNodeModelIndex node)

Returns the base URI for node. This is always the document URI. This is safe, works and is often ok.

Reimplemented from QAbstractXmlNodeModel.

See also documentUri().

QXmlNodeModelIndex QSimpleXmlNodeModel.elementById (self, QXmlName id)

Always returns a default constructed QXmlNodeModelIndex instance, regardless of id.

This effectively means the model has no elements that has an id.

Reimplemented from QAbstractXmlNodeModel.

QXmlNamePool QSimpleXmlNodeModel.namePool (self)

Returns the name pool that is associated with this model. The implementation of name() would use this to create names.

QVector<QXmlName> QSimpleXmlNodeModel.namespaceBindings (self, QXmlNodeModelIndex)

Returns always an empty QVector. This signals that no namespace bindings are in scope for node.

Reimplemented from QAbstractXmlNodeModel.

QVector<QXmlNodeModelIndex> QSimpleXmlNodeModel.nodesByIdref (self, QXmlName idref)

Always returns an empty vector, regardless of idref.

This effectively means the model has no elements or attributes of type IDREF.

Reimplemented from QAbstractXmlNodeModel.

QString QSimpleXmlNodeModel.stringValue (self, QXmlNodeModelIndex node)

If node is an element or attribute, typedValue() is called, and the return value converted to a string, as per XQuery's rules.

If node is another type of node, the empty string is returned.

If this function is overriden for for instance comments or processing instructions, it is important to remember to call this function for elements and attribute, if they have atomic values that are not of type xs:string, such that they get formatted according to XQuery.

Reimplemented from QAbstractXmlNodeModel.


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