00001
00002
00007 #ifndef __DOMPARSERCOMMON_H__
00008 #define __DOMPARSERCOMMON_H__
00009
00010 #include <string>
00011 #include <map>
00012 #include <memory>
00013
00014 #include <xercesc/dom/DOM.hpp>
00015 #include "DomErrorHandler.H"
00016 #include "CommonData.H"
00017
00018 #include "libepp_nicbr.H"
00019
00020 using std::string;
00021 using std::map;
00022 using std::less;
00023 using std::auto_ptr;
00024
00025 XERCES_CPP_NAMESPACE_USE
00026
00027 LIBEPP_NICBR_NS_BEGIN
00028
00030 class DomParserCommon
00031 {
00032 public:
00034 DomParserCommon();
00035
00037 ~DomParserCommon();
00038
00040
00043 void enable_validation(const string& schemas_dir = SCHEMASDIR);
00044
00046 void disable_validation();
00047
00049
00053 static string str_transcode(const XMLCh *const to_transcode);
00054
00055 protected:
00057
00061 DOMNode *parse(const string &xml_payload);
00062
00064
00068 void fill_postal_info(DOMNode *n, PostalInfo *postal_info);
00069
00071
00075 map< string, string, less<string> > get_children_simple(DOMNode *n);
00076
00078
00082 map< string, string, less<string> > get_attributes(DOMNode *n);
00083
00085 DOMBuilder *_builder;
00086
00088 DomErrorHandler _error_handler;
00089 };
00090
00091 LIBEPP_NICBR_NS_END
00092 #endif //__DOMPARSERCOMMON_H__