QXmlDTDHandler Class
QXmlDTDHandler 类为报告 XML 数据的 DTD 内容提供了一个接口。更多
Header: | #include <QXmlDTDHandler> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Core5Compat) target_link_libraries(mytarget PRIVATE Qt6::Core5Compat) |
qmake: | QT += core5compat |
继承于 |
注意:该类中的所有函数都是可重入的。
公共函数
virtual | ~QXmlDTDHandler() |
virtual QString | errorString() const = 0 |
virtual bool | notationDecl(const QString &name, const QString &publicId, const QString &systemId) = 0 |
virtual bool | unparsedEntityDecl(const QString &name, const QString &publicId, const QString &systemId, const QString ¬ationName) = 0 |
详细说明
如果应用程序需要有关符号和未解析实体的信息,可以实现该接口,并通过QXmlReader::setDTDHandler() 注册一个实例。
请注意,该接口只包括 XML 建议要求处理器报告的 DTD 事件,即分别使用notationDecl() 和unparsedEntityDecl() 的符号和未解析实体声明。
另请参见 QXmlDeclHandler,QXmlContentHandler,QXmlEntityResolver,QXmlErrorHandler 和QXmlLexicalHandler 。
成员函数文档
[virtual noexcept]
QXmlDTDHandler::~QXmlDTDHandler()
销毁 DTD 处理程序。
[pure virtual]
QString QXmlDTDHandler::errorString() const
如果有处理函数返回false
,阅读器会调用该函数获取错误字符串。
[pure virtual]
bool QXmlDTDHandler::notationDecl(const QString &name, const QString &publicId, const QString &systemId)
当阅读器解析完一个符号声明后,就会调用该函数。
参数name 是符号名称,publicId 是符号的公共标识符,systemId 是符号的系统标识符。
如果该函数返回false
,阅读器将停止解析并报错。阅读器使用函数errorString() 获取错误信息。
[pure virtual]
bool QXmlDTDHandler::unparsedEntityDecl(const QString &name, const QString &publicId, const QString &systemId, const QString ¬ationName)
阅读器在发现未解析的实体声明时会调用该函数。
参数name 是未解析实体的名称,publicId 是实体的公共标识符,systemId 是实体的系统标识符,notationName 是相关符号的名称。
如果该函数返回false
,阅读器就会停止解析并报错。阅读器使用函数errorString() 获取错误信息。
© 2025 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.