00001 #ifndef __XML_ERRORHANDLER_H 00002 #define __XML_ERRORHANDLER_H 00003 00004 #include "mimasconfig.h" 00005 00006 #ifdef HAVE_XALAN 00007 00008 #include <sax/ErrorHandler.hpp> 00009 #include <string> 00010 00011 #ifdef XERCES_HAS_CPP_NAMESPACE 00012 using namespace XERCES_CPP_NAMESPACE; 00013 #endif 00014 #ifdef XALAN_HAS_CPP_NAMESPACE 00015 using namespace XALAN_CPP_NAMESPACE; 00016 #endif 00017 00018 namespace mimas { 00019 00027 class xml_errorhandler: public ErrorHandler 00028 { 00029 public: 00031 xml_errorhandler(void); 00035 void warning(const SAXParseException &toCatch); 00039 void error(const SAXParseException &toCatch); 00043 void fatalError(const SAXParseException &toCatch); 00046 void resetErrors(void); 00049 bool getErrorOccurred(void) const { return errorOccurred; } 00052 const std::string &getErrorMessage(void) const { return message; } 00053 protected: 00057 void triggerError( const std::string &type, 00058 const SAXParseException &toCatch ); 00064 std::string createMessage( const std::string &type, 00065 const SAXParseException &toCatch ); 00067 bool errorOccurred; 00069 std::string message; 00070 }; 00071 00073 00074 }; 00075 00076 #endif 00077 00078 #endif