Go to the documentation of this file.00001 #ifndef HCALConfigDBTools_XMLTools_XMLDOMBlock_h
00002 #define HCALConfigDBTools_XMLTools_XMLDOMBlock_h
00003
00004
00005
00006
00007
00016
00017
00018
00019
00020
00021
00022
00023 #include <boost/shared_ptr.hpp>
00024 #include <string>
00025 #include <xercesc/parsers/XercesDOMParser.hpp>
00026 #include <xercesc/sax/HandlerBase.hpp>
00027 #include <xercesc/dom/DOM.hpp>
00028
00029
00030
00031
00032
00034
00035
00036
00037
00038
00039
00040 XERCES_CPP_NAMESPACE_USE
00041
00042 class XMLProcessor;
00043
00044 class XMLDOMBlock
00045 {
00046
00047 friend class XMLProcessor;
00048
00049 public:
00050
00051 XMLDOMBlock();
00052 XMLDOMBlock( std::string xmlFileName );
00053 XMLDOMBlock( InputSource & _source );
00054 XMLDOMBlock( std::string _root, int rootElementName );
00055
00056 DOMDocument * getDocument( void );
00057 DOMDocument * getDocumentConst( void ) const;
00058 DOMDocument * getNewDocument( std::string xmlFileName );
00059 std::string & getString( void );
00060 std::string & getString( DOMNode * _node );
00061 int write( std::string target = "stdout" );
00062 virtual ~XMLDOMBlock();
00063
00064 const char * getTagValue( const std::string & tagName, int _item = 0, DOMDocument * _document = NULL );
00065 const char * getTagValue( const std::string & tagName, int _item, DOMElement * _document );
00066 const char * getTagAttribute( const std::string & tagName, const std::string & attrName, int _item = 0 );
00067
00068 DOMElement * add_element(DOMElement * parent, XMLCh * tagname, XMLCh * value);
00069
00070 DOMNode * setTagValue( const std::string & tagName, const std::string & tagValue, int _item = 0, DOMDocument * _document = NULL );
00071 DOMNode * setTagValue( DOMElement * _elem, const std::string & tagName, const std::string & tagValue, int _item = 0 );
00072 DOMNode * setTagValue( const std::string & tagName, const int & tagValue, int _item = 0, DOMDocument * _document = NULL );
00073 DOMNode * setTagValue( DOMElement * _elem, const std::string & tagName, const int & tagValue, int _item = 0 );
00074 DOMNode * setTagAttribute( const std::string & tagName, const std::string & attrName, const std::string & attrValue, int _item = 0 );
00075 DOMNode * setTagAttribute( DOMElement * _elem, const std::string & tagName, const std::string & attrName, const std::string & attrValue, int _item = 0);
00076 DOMNode * setTagAttribute( const std::string & tagName, const std::string & attrName, const int & attrValue, int _item = 0 );
00077 DOMNode * setTagAttribute( DOMElement * _elem, const std::string & tagName, const std::string & attrName, const int & attrValue, int _item = 0);
00078 std::string getTimestamp( time_t _time );
00079
00080 void parse( InputSource & _source );
00081
00082 XMLDOMBlock & operator+=( const XMLDOMBlock & other);
00083
00084
00085
00086
00087
00088
00089
00090
00091 protected:
00092
00093 int init( std::string _root );
00094
00095 XMLProcessor * theProcessor;
00096 XercesDOMParser * parser;
00097 ErrorHandler * errHandler;
00098 DOMDocument * document;
00099 std::string theFileName;
00100 std::string * the_string;
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114 };
00115
00116
00117 #endif