이 페이지에서

QXmlStreamAttributes Class

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)
bool hasAttribute(QAnyStringView qualifiedName) const
bool hasAttribute(QAnyStringView namespaceUri, QAnyStringView name) const
QStringView value(QAnyStringView namespaceUri, QAnyStringView name) const
QStringView value(QAnyStringView qualifiedName) const

상세 설명

리더가 start element 를 보고할 때, QXmlStreamReader 는 attributes()에서 속성을 반환합니다. 이 클래스는 QXmlStreamWriter 와 함께 writeAttributes()의 인수로도 사용할 수 있습니다.

편의 함수 value()는 벡터를 순회하며, 주어진 namespaceUri와 속성 이름에 해당하는 속성 값을 반환합니다.

append()를 사용하여 새로운 속성을 추가할 수 있습니다.

멤버 함수 문서

QXmlStreamAttributes::QXmlStreamAttributes()

QXmlStreamAttributes의 생성자입니다.

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

namespaceUri 에서 정의된 네임스페이스에 name 라는 새 속성을 추가하며, 값은 value 입니다. namespaceUri 은 비어 있을 수 있습니다.

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

qualifiedName 라는 정규화된 이름과 value 라는 값을 가진 새로운 속성을 추가합니다.

이 함수는 오버로드된 함수입니다.

bool QXmlStreamAttributes::hasAttribute(QAnyStringView qualifiedName) const

이 QXmlStreamAttributes 에 qualifiedName 라는 정규화된 이름을 가진 속성이 있으면 true 를 반환하고, 그렇지 않으면 false 를 반환합니다.

이 메서드는 네임스페이스를 인식하지 않는다는 점에 유의하십시오. 예를 들어, 이 QXmlStreamAttributes 에 어휘명이 "xlink:href"인 속성이 포함되어 있다고 해도, xlink 접두사는 어떤 네임스페이스에도 바인딩될 수 있으므로, XLink 네임스페이스 내에 href 라는 이름의 속성이 존재한다는 것을 의미하지는 않습니다. 네임스페이스를 인식하는 코드를 작성하려면, 네임스페이스 URI와 로컬 이름을 매개변수로 받는 오버로드를 사용하십시오.

bool QXmlStreamAttributes::hasAttribute(QAnyStringView namespaceUri, QAnyStringView name) const

이 QXmlStreamAttributes 에 namespaceUri 및 name 과 일치하는 네임스페이스 URI와 이름을 가진 속성이 있는 경우 true 를 반환하고, 그렇지 않은 경우 false 를 반환합니다.

이 함수는 오버로드된 함수입니다.

[noexcept] QStringView QXmlStreamAttributes::value(QAnyStringView namespaceUri, QAnyStringView name) const

namespaceUri 로 지정된 네임스페이스 내의 name 속성 값을 반환하거나, 해당 속성이 정의되지 않은 경우 빈 문자열 참조를 반환합니다. namespaceUri 는 비어 있을 수 있습니다.

참고: Qt 6.6 이전버전에서는 이 함수가 QString 과 QLatin1StringView 의 조합만을 허용하는 오버로드 세트로 구현되었습니다.

[noexcept] QStringView QXmlStreamAttributes::value(QAnyStringView qualifiedName) const

qualifiedName 라는 정규화된 이름을 가진 속성의 값을 반환하며, 해당 속성이 정의되어 있지 않은 경우 빈 문자열 참조를 반환합니다. 정규화된 이름은 XML 데이터 내 속성의 원시 이름입니다. 이는 네임스페이스 접두사, 콜론(:), 그리고 속성의 로컬 이름으로 구성됩니다. 네임스페이스 접두사는 고유하지 않으므로(동일한 접두사가 서로 다른 네임스페이스를 가리킬 수 있고, 서로 다른 접두사가 동일한 네임스페이스를 가리킬 수 있음), 한정된 이름을 사용해서는 안 되며, 대신 해결된 namespaceUri와 속성의 로컬 이름을 사용해야 합니다.

참고: Qt 6.6 이전버전에서는 이 함수가 ` QString ` 및 ` QLatin1StringView `만 허용하는 오버로드된 set으로 구현되었습니다.

이 함수는 오버로드된 함수입니다.

© 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.