class MyErrorHandler : public QXmlErrorHandler { public: bool error(const QXmlParseException& e) override { qWarning() << "XML error occurred at line" << e.lineNumber() << ":" << e.message(); return true; } }; QXmlSimpleReader xmlReader; MyErrorHandler handler; xmlReader.setErrorHandler(&handler);
QXmlSimpleReader xmlReader; xmlReader.setErrorHandler(&QXmlSimpleReader::defaultErrorHandler);This example sets the default error handler, which will print error messages to the console and abort parsing if a fatal error occurs. Package/Library: Qt.