En esta página

QXmlStreamAttribute Class

La clase QXmlStreamAttribute representa un único atributo XML. Más...

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

Esta clase es igual-comparable.

Nota: Todas las funciones de esta clase son reentrantes.

Funciones públicas

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 &lhs, const QXmlStreamAttribute &rhs)
bool operator==(const QXmlStreamAttribute &lhs, const QXmlStreamAttribute &rhs)

Descripción detallada

Un atributo consta de un atributo namespaceUri(), opcionalmente vacío, un atributo name(), un atributo value() y un atributo isDefault().

El nombre en bruto del atributo XML se devuelve como qualifiedName().

Documentación de las funciones de los miembros

QXmlStreamAttribute::QXmlStreamAttribute()

Crea un atributo vacío.

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

Construye un atributo con nombre cualificado qualifiedName y valor value.

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

Construye un atributo en el espacio de nombres descrito con namespaceUri con name y valor value.

bool QXmlStreamAttribute::isDefault() const

Devuelve true si el analizador sintáctico ha añadido este atributo con un valor por defecto tras una declaración ATTLIST en la DTD; en caso contrario, devuelve false.

QStringView QXmlStreamAttribute::name() const

Devuelve el nombre local del atributo.

QStringView QXmlStreamAttribute::namespaceUri() const

Devuelve el namespaceUri resuelto del atributo, o una referencia de cadena vacía si el atributo no tiene un espacio de nombres definido.

QStringView QXmlStreamAttribute::prefix() const

Devuelve el prefijo del espacio de nombres del atributo.

Véase también name() y qualifiedName().

QStringView QXmlStreamAttribute::qualifiedName() const

Devuelve el nombre cualificado del atributo.

Un nombre cualificado es el nombre en bruto de un atributo en los datos XML. Consiste en el espacio de nombres prefix(), seguido de dos puntos, seguido del atributo local name(). Dado que el prefijo del espacio de nombres no es único (el mismo prefijo puede apuntar a diferentes espacios de nombres y diferentes prefijos pueden apuntar al mismo espacio de nombres), no debería utilizar qualifiedName(), sino el namespaceUri() resuelto y el name() local del atributo.

QStringView QXmlStreamAttribute::value() const

Devuelve el valor del atributo.

No miembros relacionados

[noexcept] bool operator!=(const QXmlStreamAttribute &lhs, const QXmlStreamAttribute &rhs)

Compara el atributo lhs con rhs y devuelve true si no son iguales; en caso contrario devuelve false.

[noexcept] bool operator==(const QXmlStreamAttribute &lhs, const QXmlStreamAttribute &rhs)

Compara el atributo lhs con rhs y devuelve true si son iguales; en caso contrario devuelve false.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.