QXmlStreamAttribute 类

QXmlStreamAttribute 类表示单 XML 属性。 更多...

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

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

公共函数

QXmlStreamAttribute ()
QXmlStreamAttribute (const QString & qualifiedName , const QString & value )
QXmlStreamAttribute (const QString & namespaceUri , const QString & name , const QString & value )
bool isDefault () const
QStringView name () const
QStringView namespaceUri () const
QStringView prefix () const
QStringView qualifiedName () const
QStringView value () const
bool operator!= (const QXmlStreamAttribute & other ) const
bool operator== (const QXmlStreamAttribute & other ) const

详细描述

An attribute consists of an optionally empty namespaceUri (), name (), value (), and an isDefault () attribute.

The raw XML attribute name is returned as qualifiedName ().

成员函数文档编制

QXmlStreamAttribute:: QXmlStreamAttribute ()

Creates an empty attribute.

QXmlStreamAttribute:: QXmlStreamAttribute (const QString & qualifiedName , const QString & value )

Constructs an attribute with qualified name qualifiedName and value value .

QXmlStreamAttribute:: QXmlStreamAttribute (const QString & namespaceUri , const QString & name , const QString & value )

Constructs an attribute in the namespace described with namespaceUri with name and value value .

bool QXmlStreamAttribute:: isDefault () const

返回 true if the parser added this attribute with a default value following an ATTLIST declaration in the DTD; otherwise returns false .

QStringView QXmlStreamAttribute:: name () const

Returns the attribute's local name.

QStringView QXmlStreamAttribute:: namespaceUri () const

Returns the attribute's resolved namespaceUri, or an empty string reference if the attribute does not have a defined namespace.

QStringView QXmlStreamAttribute:: prefix () const

Returns the attribute's namespace prefix.

另请参阅 name () 和 qualifiedName ().

QStringView QXmlStreamAttribute:: qualifiedName () const

Returns the attribute's qualified name.

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 qualifiedName(), but the resolved namespaceUri () and the attribute's local name ().

QStringView QXmlStreamAttribute:: value () const

Returns the attribute's value.

bool QXmlStreamAttribute:: operator!= (const QXmlStreamAttribute & other ) const

Compares this attribute with other 并返回 true if they are not equal; otherwise returns false .

bool QXmlStreamAttribute:: operator== (const QXmlStreamAttribute & other ) const

Compares this attribute with other 并返回 true if they are equal; otherwise returns false .