QSimpleXmlNodeModel Class

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

头: #include <QSimpleXmlNodeModel>
qmake: QT += xmlpatterns
Since: Qt 4.4
继承: QAbstractXmlNodeModel

该类在 Qt 4.4 引入。

注意: 此类的所有函数 可重入 .

公共函数

QSimpleXmlNodeModel (const QXmlNamePool & namePool )
virtual ~QSimpleXmlNodeModel ()
QXmlNamePool & namePool () const

重实现公共函数

virtual QUrl baseUri (const QXmlNodeModelIndex & node ) const override
virtual QXmlNodeModelIndex elementById (const QXmlName & id ) const override
virtual QVector<QXmlName> namespaceBindings (const QXmlNodeModelIndex & node ) const override
virtual QVector<QXmlNodeModelIndex> nodesByIdref (const QXmlName & idref ) const override
virtual QString stringValue (const QXmlNodeModelIndex & node ) const override

详细描述

子类化 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.

成员函数文档编制

QSimpleXmlNodeModel:: QSimpleXmlNodeModel (const QXmlNamePool & namePool )

Constructs a QSimpleXmlNodeModel for use with with the specified namePool .

[虚拟] QSimpleXmlNodeModel:: ~QSimpleXmlNodeModel ()

析构函数。

[override virtual] QUrl QSimpleXmlNodeModel:: baseUri (const QXmlNodeModelIndex & node ) const

重实现: QAbstractXmlNodeModel::baseUri (const QXmlNodeModelIndex &n) const.

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

另请参阅 documentUri ().

[override virtual] QXmlNodeModelIndex QSimpleXmlNodeModel:: elementById (const QXmlName & id ) const

重实现: QAbstractXmlNodeModel::elementById (const QXmlName &id) const.

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

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

QXmlNamePool &QSimpleXmlNodeModel:: namePool () const

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

[override virtual] QVector < QXmlName > QSimpleXmlNodeModel:: namespaceBindings (const QXmlNodeModelIndex & node ) const

重实现: QAbstractXmlNodeModel::namespaceBindings (const QXmlNodeModelIndex &n) const.

Always returns an empty QVector . This signals that no namespace bindings are in scope for node .

[override virtual] QVector < QXmlNodeModelIndex > QSimpleXmlNodeModel:: nodesByIdref (const QXmlName & idref ) const

重实现: QAbstractXmlNodeModel::nodesByIdref (const QXmlName &idref) const.

Always returns an empty vector, regardless of idref .

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

[override virtual] QString QSimpleXmlNodeModel:: stringValue (const QXmlNodeModelIndex & node ) const

重实现: QAbstractXmlNodeModel::stringValue (const QXmlNodeModelIndex &n) const.

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

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

If this function is overridden 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 .