|  | Home · All Classes · Modules

# QSimpleXmlNodeModel Class Reference
[QtXmlPatterns module]

The QSimpleXmlNodeModel class is an implementation of QAbstractXmlNodeModel sufficient for many common cases. More...

Inherits QAbstractXmlNodeModel.

### Methods

- __init__ (self, QXmlNamePool namePool)
- QUrl baseUri (self, QXmlNodeModelIndex node)
- QXmlNodeModelIndex elementById (self, QXmlName id)
- QXmlNamePool namePool (self)
- QVector<QXmlName> namespaceBindings (self, QXmlNodeModelIndex)
- QVector<QXmlNodeModelIndex> nodesByIdref (self, QXmlName idref)
- QString stringValue (self, QXmlNodeModelIndex node)

## Detailed Description

The QSimpleXmlNodeModel class is an implementation of QAbstractXmlNodeModel sufficient for many common cases.

Subclassing QAbstractXmlNodeModel can be a significant task, because it requires implementing several, complex member functions. QSimpleXmlNodeModel provides default implementations of these member functions that are suitable for a wide range of node models.

Subclasses of QSimpleXmlNodeModel must be thread-safe.

## Method Documentation

### QSimpleXmlNodeModel.__init__ (self, QXmlNamePool namePool)

Constructs a QSimpleXmlNodeModel for use with with the specified namePool.

### QUrl QSimpleXmlNodeModel.baseUri (self, QXmlNodeModelIndex node)

Returns the base URI for node. This is always the document URI.

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 have an id.

Reimplemented from QAbstractXmlNodeModel.

### QXmlNamePool QSimpleXmlNodeModel.namePool (self)

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

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

Always returns 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 comments or processing instructions, it is important to remember to call it (for elements and attributes having values not of type `xs:string`) to ensure that the values are formatted according to XQuery.

Reimplemented from QAbstractXmlNodeModel.