QXmlErrorHandler 类提供报告 XML 数据错误的接口。 更多...
头: | #include <QXmlErrorHandler> |
CMake: |
find_package(Qt6 COMPONENTS Core5Compat REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::Core5Compat) |
qmake: | QT += core5compat |
继承者: | QXmlDefaultHandler |
注意: 此类的所有函数 可重入 .
virtual | ~QXmlErrorHandler () |
virtual bool | error (const QXmlParseException & exception ) = 0 |
virtual QString | errorString () const = 0 |
virtual bool | fatalError (const QXmlParseException & exception ) = 0 |
virtual bool | warning (const QXmlParseException & exception ) = 0 |
If you want your application to report errors to the user or to perform customized error handling, you should subclass this class.
You can set the error handler with QXmlReader::setErrorHandler ().
Errors can be reported using warning (), error () 和 fatalError (), with the error text being reported with errorString ().
另请参阅 QXmlDTDHandler , QXmlDeclHandler , QXmlContentHandler , QXmlEntityResolver ,和 QXmlLexicalHandler .
[虚拟]
QXmlErrorHandler::
~QXmlErrorHandler
()
Destroys the error handler.
[pure virtual]
bool
QXmlErrorHandler::
error
(const
QXmlParseException
&
exception
)
A reader might use this function to report a recoverable error. A recoverable error corresponds to the definiton of "error" in section 1.2 of the XML 1.0 specification. Details of the error are stored in exception .
The reader must continue to provide normal parsing events after invoking this function.
若此函数返回
false
the reader stops parsing and reports an error. The reader uses the function
errorString
() to get the error message.
[pure virtual]
QString
QXmlErrorHandler::
errorString
() const
The reader calls this function to get an error string if any of the handler functions returns
false
.
[pure virtual]
bool
QXmlErrorHandler::
fatalError
(const
QXmlParseException
&
exception
)
A reader must use this function to report a non-recoverable error. Details of the error are stored in exception .
若此函数返回
true
the reader might try to go on parsing and reporting further errors, but no regular parsing events are reported.
[pure virtual]
bool
QXmlErrorHandler::
warning
(const
QXmlParseException
&
exception
)
A reader might use this function to report a warning. Warnings are conditions that are not errors or fatal errors as defined by the XML 1.0 specification. Details of the warning are stored in exception .
若此函数返回
false
the reader stops parsing and reports an error. The reader uses the function
errorString
() to get the error message.