QXmlStreamAttributes 类

QXmlStreamAttributes 类表示向量为 QXmlStreamAttribute . 更多...

头: #include <QXmlStreamAttributes>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
继承: QList

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

公共函数

QXmlStreamAttributes ()
void append (const QString & namespaceUri , const QString & name , const QString & value )
void append (const QString & qualifiedName , const QString & value )
QStringView value (const QString & namespaceUri , const QString & name ) const
QStringView value (const QString & namespaceUri , QLatin1StringView name ) const
QStringView value (QLatin1StringView namespaceUri , QLatin1StringView name ) const
QStringView value (const QString & qualifiedName ) const
QStringView value (QLatin1StringView qualifiedName ) const

详细描述

Attributes are returned by a QXmlStreamReader in 属性 () when the reader reports a start element . The class can also be used with a QXmlStreamWriter as an argument to writeAttributes ().

The convenience function value () loops over the vector and returns an attribute value for a given namespaceUri and an attribute's name.

New attributes can be added with append ().

成员函数文档编制

QXmlStreamAttributes:: QXmlStreamAttributes ()

A constructor for QXmlStreamAttributes.

void QXmlStreamAttributes:: append (const QString & namespaceUri , const QString & name , const QString & value )

Appends a new attribute with name in the namespace described with namespaceUri , and value valuenamespaceUri can be empty.

void QXmlStreamAttributes:: append (const QString & qualifiedName , const QString & value )

这是重载函数。

Appends a new attribute with qualified name qualifiedName and value value .

QStringView QXmlStreamAttributes:: value (const QString & namespaceUri , const QString & name ) const

Returns the value of the attribute name in the namespace described with namespaceUri , or an empty string reference if the attribute is not defined. The namespaceUri can be empty.

QStringView QXmlStreamAttributes:: value (const QString & namespaceUri , QLatin1StringView name ) const

这是重载函数。

Returns the value of the attribute name in the namespace described with namespaceUri , or an empty string reference if the attribute is not defined. The namespaceUri can be empty.

QStringView QXmlStreamAttributes:: value ( QLatin1StringView namespaceUri , QLatin1StringView name ) const

这是重载函数。

Returns the value of the attribute name in the namespace described with namespaceUri , or an empty string reference if the attribute is not defined. The namespaceUri can be empty.

QStringView QXmlStreamAttributes:: value (const QString & qualifiedName ) const

这是重载函数。

Returns the value of the attribute with qualified name qualifiedName , or an empty string reference if the attribute is not defined. A qualified name is the raw name of an attribute in the XML data. It consists of the namespace prefix, followed by colon, followed by the attribute's local name. Since the namespace prefix is not unique (the same prefix can point to different namespaces and different prefixes can point to the same namespace), you shouldn't use qualified names, but a resolved namespaceUri and the attribute's local name.

QStringView QXmlStreamAttributes:: value ( QLatin1StringView qualifiedName ) const

这是重载函数。

Returns the value of the attribute with qualified name qualifiedName , or an empty string reference if the attribute is not defined. A qualified name is the raw name of an attribute in the XML data. It consists of the namespace prefix, followed by colon, followed by the attribute's local name. Since the namespace prefix is not unique (the same prefix can point to different namespaces and different prefixes can point to the same namespace), you shouldn't use qualified names, but a resolved namespaceUri and the attribute's local name.