00001 /* ${copyright}$ */ 00002 /* $Id: DomParserCommon.H 879 2007-03-06 12:25:51Z eduardo $ */ 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 #include "DSInfo.H" 00018 00019 #include "libepp_nicbr.H" 00020 00021 using std::string; 00022 using std::map; 00023 using std::less; 00024 using std::auto_ptr; 00025 00026 XERCES_CPP_NAMESPACE_USE 00027 00028 LIBEPP_NICBR_NS_BEGIN 00029 00031 class DomParserCommon 00032 { 00033 public: 00035 DomParserCommon(); 00036 00038 ~DomParserCommon(); 00039 00041 00044 void enable_validation(const string& schemas_dir = SCHEMASDIR); 00045 00047 void disable_validation(); 00048 00050 00054 static string str_transcode(const XMLCh *const to_transcode); 00055 00056 protected: 00058 00062 DOMNode *parse(const string &xml_payload); 00063 00065 00069 void fill_postal_info(DOMNode *n, PostalInfo *postal_info); 00070 00072 00076 void fill_ds_info(DOMNode *n, DSInfo *ds_info); 00077 00079 00083 map< string, string, less<string> > get_children_simple(DOMNode *n); 00084 00086 00090 map< string, string, less<string> > get_attributes(DOMNode *n); 00091 00093 DOMBuilder *_builder; 00094 00096 DomErrorHandler _error_handler; 00097 }; 00098 00099 LIBEPP_NICBR_NS_END 00100 #endif //__DOMPARSERCOMMON_H__