/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Calibration/xmlBase/xmlBase-00-00-03/xmlBase/XmlErrorHandler.h

Go to the documentation of this file.
00001 // $Header: /bes/bes/BossCvs/Calibration/xmlBase/xmlBase/XmlErrorHandler.h,v 1.1.1.1 2005/10/17 06:10:27 maqm Exp $
00002 //  Author:  J. Bogart
00003 
00004 #ifndef xmlBase_XmlErrorHandler_h
00005 #define xmlBase_XmlErrorHandler_h
00006 
00007 #include <xercesc/sax/ErrorHandler.hpp>
00008 #include <xercesc/sax/SAXParseException.hpp>
00009 #include <iostream>
00010 #include <string>
00011 
00012 namespace xmlBase {
00013   XERCES_CPP_NAMESPACE_USE
00014 
00016   class ParseException : std::exception {
00017   public:
00018     ParseException(const std::string& extraInfo = "") : std::exception(),
00019       m_name("ParseException"), m_extra(extraInfo) {}
00020     virtual ~ParseException() throw() {}
00021     virtual std::string getMsg() {
00022       std::string msg = m_name + ": " + m_extra;
00023       return msg;}
00024     virtual const char* what() {
00025       return m_extra.c_str();
00026     }
00027   protected: 
00028     std::string m_name;
00029   private:
00030     std::string m_extra;
00031   };
00032 
00033 
00038   class XmlErrorHandler : public XERCES_CPP_NAMESPACE_QUALIFIER ErrorHandler  {
00039   public:
00040     // Constructor, destructor have little to do.
00041     XmlErrorHandler(bool throwErrors = false) : m_throwErrors(throwErrors)
00042       {resetErrors();}
00043     ~XmlErrorHandler() {}
00044     // The following methods all override pure virtual methods
00045     // from ErrorHandler base class.
00047     void warning(const SAXParseException& exception);
00049     void error(const SAXParseException& exception);
00051     void fatalError(const SAXParseException& exception);
00053     void resetErrors();
00054 
00055     // "get" methods
00056     int getWarningCount() const {return m_nWarning;}
00057     int getErrorCount() const {return m_nError;}
00058     int getFatalCount() const {return m_nFatal;}
00059 
00060   private: 
00061     int m_nWarning;
00062     int m_nError;
00063     int m_nFatal;
00064     bool m_throwErrors;
00065   };                  // end class definition
00066 }                     // end namespace xml
00067 
00068 #endif

Generated on Tue Nov 29 22:57:58 2016 for BOSS_7.0.2 by  doxygen 1.4.7