이 페이지에서

QXmlStreamEntityResolver Class

QXmlStreamEntityResolver 클래스는 QXmlStreamReader 에 대한 엔티티 리졸버를 제공합니다. 더 보기...

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

참고: 이 클래스의 모든 함수는 재진입 가능합니다.

공개 함수

QXmlStreamEntityResolver()
virtual ~QXmlStreamEntityResolver()
virtual QString resolveUndeclaredEntity(const QString &name)

상세 설명

QXmlStreamReader 에 엔티티를 확장하는 방법을 알리기 위해 사용하며, ` declared in the internal-set of the DTD`는 제외됩니다.

보안 고려 사항

엔티티 사이클

QXmlStreamReader 는 entities defined in the DTD 내의 순환만 감지하고 거부할 뿐, QXmlStreamEntityResolver 인터페이스의 구현체에서 확장된 엔티티 내의 순환은 감지하지 않으므로, 엔티티가 순환 구조로 해결되는 것을 피하도록 주의해야 합니다.

이는 설계상 의도된 사항입니다. QXmlStreamReader 는 구체적인 QXmlStreamEntityResolver 구현체에 해당 작업을 맡깁니다. 문자용 XML 엔티티 정의와 같은 정적 매핑의 경우, 이는 당연히 보장되므로 백그라운드에서 추적을 수행하면 모든 사용자의 처리 속도가 저하될 뿐입니다.

신뢰할 수 없는 소스를 포함한 외부 입력에서 엔티티 정의를 읽을 때 상황이 흥미로워집니다. 이 경우, 구현체는 입력으로 사용하는 확장 결과가 순환 구조를 포함하지 않도록 보장해야 합니다. 이는 선형 시간 및 공간 복잡도로 구현 가능한 간단한 그래프 연산이며, 로드 시점에 미리 수행될 수 있으므로 resolveUndeclaredEntity()의 성능에는 영향을 미치지 않습니다.

엔티티 확장 제한

현재로서는 이 클래스에 의해 해결된 엔티티는 QXmlStreamReader::entityExpansionLimit()의 카운트에 포함되지 않습니다. 이는 향후 Qt 버전에서 변경될 수 있습니다.

당분간은 외부 입력에서 엔티티 정의를 읽어오는 경우, 확장 상한을 직접 설정해야 합니다. 사이클 감지 후, 최장 경로 계산은 선형 시간 및 공간으로 구현할 수 있는 간단한 그래프 연산이며, 로드 시점에 미리 수행할 수 있으므로 resolveUndeclaredEntity()의 성능에도 영향을 미치지 않습니다.

QXmlStreamReader::setEntityResolver()도 참조하십시오 .

멤버 함수 문서

[constexpr noexcept default] QXmlStreamEntityResolver::QXmlStreamEntityResolver()

QXmlStreamEntityResolver 의 인스턴스를 기본 생성합니다.

[virtual noexcept] QXmlStreamEntityResolver::~QXmlStreamEntityResolver()

엔티티 리졸버를 삭제합니다.

[virtual] QString QXmlStreamEntityResolver::resolveUndeclaredEntity(const QString &name)

이 함수를 재구현하여 선언되지 않은 엔티티 name 를 해결하고, 해당 엔티티를 대체할 텍스트를 반환하십시오. 엔티티 해결기가 해당 엔티티를 인식하지 못하는 경우, null string: QString() 를 반환하십시오. 이 경우 QXmlStreamreader에서 오류가 발생합니다. 비어 있지만 null이 아닌 문자열은 해당 엔티티의 유효한 확장으로 간주되며, 오류를 유발하지 않습니다.

기본 구현은 항상 QString() 을 반환합니다.

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