00001 #ifndef Impala_Application_SDash_Sax2Handler_h
00002 #define Impala_Application_SDash_Sax2Handler_h
00003
00004 #include <string>
00005
00006 #include <xercesc/sax2/DefaultHandler.hpp>
00007 #include <xercesc/sax/SAXParseException.hpp>
00008
00009 #include "Application/sdash/StrX.h"
00010
00011 namespace Impala {
00012 namespace Application {
00013 namespace SDash {
00014
00015 XERCES_CPP_NAMESPACE_USE
00016
00017 class Sax2Handler : public DefaultHandler
00018 {
00019
00020 public:
00021
00022 Sax2Handler() : fSawErrors(false)
00023 {
00024 }
00025
00026 virtual ~Sax2Handler()
00027 {
00028 }
00029
00030
00031
00032
00033
00034 virtual void startElement(const XMLCh* const uri
00035 , const XMLCh* const localName
00036 , const XMLCh* const qName
00037 , const Attributes& attrs)
00038 {
00039
00040 }
00041
00042 virtual void endElement(
00043 const XMLCh* const uri,
00044 const XMLCh* const localName,
00045 const XMLCh* const qname)
00046 {
00047
00048 }
00049
00050 virtual void characters( const XMLCh* const chars
00051 , const unsigned int length)
00052 {
00053
00054 }
00055
00056 virtual void ignorableWhitespace( const XMLCh* const chars
00057 , const unsigned int length)
00058 {
00059
00060 }
00061
00062 virtual void resetDocument()
00063 {
00064
00065 }
00066
00067
00068
00069
00070
00071 virtual void error(const SAXParseException& e)
00072 {
00073 fSawErrors = true;
00074 XERCES_STD_QUALIFIER cerr << "\nError at file " << StrX(e.getSystemId())
00075 << ", line " << e.getLineNumber()
00076 << ", char " << e.getColumnNumber()
00077 << "\n Message: " << StrX(e.getMessage()) << XERCES_STD_QUALIFIER endl;
00078 }
00079
00080 virtual void fatalError(const SAXParseException& e)
00081 {
00082 fSawErrors = true;
00083 XERCES_STD_QUALIFIER cerr << "\nFatal Error at file " << StrX(e.getSystemId())
00084 << ", line " << e.getLineNumber()
00085 << ", char " << e.getColumnNumber()
00086 << "\n Message: " << StrX(e.getMessage()) << XERCES_STD_QUALIFIER endl;
00087 }
00088
00089 virtual void warning(const SAXParseException& e)
00090 {
00091 XERCES_STD_QUALIFIER cerr << "\nWarning at file " << StrX(e.getSystemId())
00092 << ", line " << e.getLineNumber()
00093 << ", char " << e.getColumnNumber()
00094 << "\n Message: " << StrX(e.getMessage()) << XERCES_STD_QUALIFIER endl;
00095 }
00096
00097
00098 bool getSawErrors() const
00099 {
00100 return fSawErrors;
00101 }
00102
00103
00104 private:
00105
00106 bool fSawErrors;
00107
00108 };
00109
00110 }
00111 }
00112 }
00113
00114 #endif