QXmlDTDHandler Class
QXmlDTDHandler 类提供了一个接口,用于报告 XML 数据的 DTD 内容。更多内容...
| 标题: | #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() 来获取错误消息。
© 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.