2003-11-03 17:22:45 +01:00
|
|
|
/*
|
|
|
|
Xerces Error Handler for Prometheus (and the GUI)
|
|
|
|
by Gustav Larsson
|
|
|
|
gee@pyro.nu
|
|
|
|
|
|
|
|
--Overview--
|
|
|
|
|
|
|
|
This is a class that that will let us output
|
|
|
|
Xerces C++ Parser errors in our own Log
|
|
|
|
or whatever, fit to Prometheus and foremost
|
|
|
|
the GUI.
|
|
|
|
|
|
|
|
--More info--
|
|
|
|
|
|
|
|
http://xml.apache.org/xerces-c/apiDocs/classErrorHandler.html
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef XercesErrorHandler_H
|
|
|
|
#define XercesErrorHandler_H
|
|
|
|
|
|
|
|
#include <xercesc/util/XercesDefs.hpp>
|
|
|
|
#include <xercesc/sax/ErrorHandler.hpp>
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
2003-11-06 12:54:46 +01:00
|
|
|
class CXercesErrorHandler : public XERCES_CPP_NAMESPACE::ErrorHandler
|
2003-11-03 17:22:45 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
// Constructors and Destructor
|
|
|
|
// -----------------------------------------------------------------------
|
2003-11-06 12:54:46 +01:00
|
|
|
CXercesErrorHandler() :
|
2003-11-03 17:22:45 +01:00
|
|
|
fSawErrors(false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-11-06 12:54:46 +01:00
|
|
|
~CXercesErrorHandler()
|
2003-11-03 17:22:45 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
// Implementation of the error handler interface
|
|
|
|
// -----------------------------------------------------------------------
|
2003-11-05 23:34:38 +01:00
|
|
|
void warning(const XERCES_CPP_NAMESPACE::SAXParseException& toCatch);
|
|
|
|
void error(const XERCES_CPP_NAMESPACE::SAXParseException& toCatch);
|
|
|
|
void fatalError(const XERCES_CPP_NAMESPACE::SAXParseException& toCatch);
|
2003-11-03 17:22:45 +01:00
|
|
|
void resetErrors();
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
// Getter methods
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
bool getSawErrors() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
// Private data members
|
|
|
|
//
|
|
|
|
// fSawErrors
|
|
|
|
// This is set if we get any errors, and is queryable via a getter
|
|
|
|
// method. Its used by the main code to suppress output if there are
|
|
|
|
// errors.
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
bool fSawErrors;
|
|
|
|
};
|
|
|
|
|
2003-11-06 12:54:46 +01:00
|
|
|
inline bool CXercesErrorHandler::getSawErrors() const
|
2003-11-03 17:22:45 +01:00
|
|
|
{
|
|
|
|
return fSawErrors;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|