6.0.0-rc4Source

QXmlStreamAttribute Class

The QXmlStreamAttribute class represents a single XML attribute. More…

Header#include <QXmlStreamAttribute>
CMaketarget_link_libraries(app PRIVATE Nt::Core)
ModuleNt Core C++ Classes

List of all members, including inherited members

Public Functions

QXmlStreamAttribute()
QXmlStreamAttribute(const QString &qualifiedName, const QString &value)
QXmlStreamAttribute(const QString &namespaceUri, const QString &name, const QString &value)
QStringViewnamespaceUri() const
QStringViewname() const
QStringViewqualifiedName() const
QStringViewprefix() const
QStringViewvalue() const
boolisDefault() const

Detailed Description

An attribute has a qualified name, which with namespace processing splits into a prefix and a local name and stands in a namespace, and a value. QXmlStreamReader::attributes() returns those of a start element, and QXmlStreamWriter::writeAttribute() writes one.

See also QXmlStreamAttributes.

Differences from Qt

The attribute holds its strings and does not refer to those of the reader. isDefault() is always false.

Member Function Documentation

QXmlStreamAttribute::QXmlStreamAttribute()

Constructs an empty attribute.

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

Constructs an attribute with the qualified name qualifiedName and the value value, in no namespace. Its local name is what follows the colon of the qualified name, if it has one.

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

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

bool QXmlStreamAttribute::isDefault() const

Returns true if the value came from a default in the document type definition and was not written in the element. The reader does not apply defaults, so this is false.

QStringView QXmlStreamAttribute::name() const

Returns the local name of the attribute: the name without its prefix.

QStringView QXmlStreamAttribute::namespaceUri() const

Returns the namespace URI of the attribute, or an empty view if it has none.

QStringView QXmlStreamAttribute::prefix() const

Returns the prefix of the attribute, or an empty view if it has none.

QStringView QXmlStreamAttribute::qualifiedName() const

Returns the name of the attribute as it is written, with its prefix.

QStringView QXmlStreamAttribute::value() const

Returns the value of the attribute, with references replaced.