00001
00002
00007 #ifndef __DOMPARSERCOMMON_H__
00008 #define __DOMPARSERCOMMON_H__
00009
00010 #include <string>
00011 #include <map>
00012 #include <memory>
00013
00014 #include <xercesc/parsers/XercesDOMParser.hpp>
00015 #include <xercesc/dom/DOM.hpp>
00016 #include "DomErrorHandler.H"
00017 #include "CommonData.H"
00018 #include "DSInfo.H"
00019
00020 #include "libepp_nicbr.H"
00021
00022 using std::string;
00023 using std::map;
00024 using std::less;
00025 using std::auto_ptr;
00026
00027 XERCES_CPP_NAMESPACE_USE
00028
00029 LIBEPP_NICBR_NS_BEGIN
00030
00032 class DomParserCommon
00033 {
00034 public:
00036 DomParserCommon();
00037
00039 ~DomParserCommon();
00040
00042
00045 void enable_validation(const string& schemas_dir = SCHEMASDIR);
00046
00048 void disable_validation();
00049
00051
00055 static string str_transcode(const XMLCh *const to_transcode);
00056
00057 protected:
00059
00063 DOMNode *parse(const string &xml_payload);
00064
00066
00070 void fill_postal_info(DOMNode *n, PostalInfo *postal_info);
00071
00073
00077 void fill_ds_info(DOMNode *n, DSInfo *ds_info);
00078
00080
00084 void fill_key_data(DOMNode *n, KeyData *keyData);
00085
00086 #if USE_IP_MANAGEMENT
00087
00088
00091 IpRange fill_ipRange(DOMNode *n);
00092
00094
00097 ReverseDns fill_reverseDns(DOMNode *n);
00098 #endif // USE_IP_MANAGEMENT
00099
00100 #if USE_BR_ORG
00101
00102
00105 IpRange fill_brorg_ipRange(DOMNode *n);
00106 #endif // USE_BR_ORG
00107
00109
00113 map< string, string, less<string> > get_children_simple(DOMNode *n);
00114
00116
00120 map< string, string, less<string> > get_attributes(DOMNode *n);
00121
00123 XercesDOMParser *_parser;
00124
00126 DomErrorHandler _error_handler;
00127 };
00128
00129 LIBEPP_NICBR_NS_END
00130 #endif //__DOMPARSERCOMMON_H__