00001
00002
00007 #ifndef __BEAUTIFIER_HANDLERS_H__
00008 #define __BEAUTIFIER_HANDLERS_H__
00009
00010 #include <string>
00011
00012 #include <xercesc/sax/HandlerBase.hpp>
00013
00014 #include "libepp_nicbr.H"
00015
00016 using std::auto_ptr;
00017 using std::string;
00018
00019 XERCES_CPP_NAMESPACE_USE
00020
00021 LIBEPP_NICBR_NS_BEGIN
00022
00024 struct UserData {
00025 string input_txt;
00026 string output_txt;
00027 };
00028
00030 class BeautifierHandlers : public XERCES_CPP_NAMESPACE_QUALIFIER HandlerBase
00031 {
00032 public:
00034
00037 BeautifierHandlers(UserData *pretty_data);
00038
00040 ~BeautifierHandlers();
00041
00043
00047 void startElement(const XMLCh* const name, AttributeList& attributes);
00048
00050
00054 void characters(const XMLCh* const chars, const unsigned int length);
00055
00057
00060 void endElement(const XMLCh* const chars);
00061
00063
00066 void warning(const SAXParseException& exc);
00067
00069
00072 void error(const SAXParseException& exc);
00073
00075
00078 void fatalError(const SAXParseException& exc);
00079
00080 private:
00082
00086 string str_transcode(const XMLCh *const to_transcode);
00087
00089 enum eventType {
00090 NONE = 0,
00091 START = 1,
00092 CHARACTERS = 2,
00093 END = 3
00094 };
00095
00097 int _depth;
00098
00100 UserData *_user_data;
00101
00103 eventType _last_event;
00104
00106 string _to_be_printed;
00107 };
00108
00109 LIBEPP_NICBR_NS_END
00110 #endif //__BEAUTIFIER_HANDLERS_H__