CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
XMLDOMBlock.h
Go to the documentation of this file.
1 #ifndef HCALConfigDBTools_XMLTools_XMLDOMBlock_h
2 #define HCALConfigDBTools_XMLTools_XMLDOMBlock_h
3 // -*- C++ -*-
4 //
5 // Package: XMLTools
6 // Class : XMLDOMBlock
7 //
16 //
17 // Original Author: Gena Kukartsev
18 // Created: Thu Sep 27 01:46:46 CEST 2007
19 //
20 
21 
22 #include <boost/shared_ptr.hpp>
23 #include <string>
24 #include <xercesc/parsers/XercesDOMParser.hpp>
25 #include <xercesc/sax/HandlerBase.hpp>
26 #include <xercesc/dom/DOM.hpp>
27 
28 //
29 //_____ following removed as a xalan-c component_____________________
30 //
31 //#include <xalanc/DOMSupport/XalanDocumentPrefixResolver.hpp>
33 //#include <xalanc/XalanSourceTree/XalanSourceTreeDOMSupport.hpp>
34 //#include <xalanc/XalanSourceTree/XalanSourceTreeInit.hpp>
35 //#include <xalanc/XalanSourceTree/XalanSourceTreeParserLiaison.hpp>
36 //#include <xercesc/framework/LocalFileInputSource.hpp>
37 //#include <xalanc/XPath/XPathEvaluator.hpp>
38 
39 XERCES_CPP_NAMESPACE_USE
40 
41 class XMLProcessor;
42 
44 {
45 
46  friend class XMLProcessor;
47 
48  public:
49 
50  XMLDOMBlock();
51  XMLDOMBlock( std::string xmlFileName ); // create XML from template file
52  XMLDOMBlock( InputSource & _source );
53  XMLDOMBlock( std::string _root, int rootElementName ); // create XML from scratch, second parameter is a dummy
54 
55  DOMDocument * getDocument( void );
56  DOMDocument * getDocumentConst( void ) const;
57  DOMDocument * getNewDocument( std::string xmlFileName );
58  std::string & getString( void );
59  std::string & getString( DOMNode * _node );
60  int write( std::string target = "stdout" );
61  virtual ~XMLDOMBlock();
62 
63  const char * getTagValue( const std::string & tagName, int _item = 0, DOMDocument * _document = NULL );
64  const char * getTagValue( const std::string & tagName, int _item, DOMElement * _document );
65  const char * getTagAttribute( const std::string & tagName, const std::string & attrName, int _item = 0 );
66 
67  DOMElement * add_element(DOMElement * parent, XMLCh * tagname, XMLCh * value);
68 
69  DOMNode * setTagValue( const std::string & tagName, const std::string & tagValue, int _item = 0, DOMDocument * _document = NULL );
70  DOMNode * setTagValue( DOMElement * _elem, const std::string & tagName, const std::string & tagValue, int _item = 0 );
71  DOMNode * setTagValue( const std::string & tagName, const int & tagValue, int _item = 0, DOMDocument * _document = NULL );
72  DOMNode * setTagValue( DOMElement * _elem, const std::string & tagName, const int & tagValue, int _item = 0 );
73  DOMNode * setTagAttribute( const std::string & tagName, const std::string & attrName, const std::string & attrValue, int _item = 0 );
74  DOMNode * setTagAttribute( DOMElement * _elem, const std::string & tagName, const std::string & attrName, const std::string & attrValue, int _item = 0);
75  DOMNode * setTagAttribute( const std::string & tagName, const std::string & attrName, const int & attrValue, int _item = 0 );
76  DOMNode * setTagAttribute( DOMElement * _elem, const std::string & tagName, const std::string & attrName, const int & attrValue, int _item = 0);
77  std::string getTimestamp( time_t _time );
78 
79  void parse( InputSource & _source );
80 
81  XMLDOMBlock & operator+=( const XMLDOMBlock & other);
82 
83  //
84  //_____ following removed as a xalan-c component_____________________
85  //
86  //===> Xalan-c (XPath) stuff
87  //int read_xml_file_xalan( std::string filename );
88  //const XObjectPtr eval_xpath( std::string context, std::string expression );
89 
90  protected:
91 
92  int init( std::string _root );
93 
95  XercesDOMParser * parser;
96  ErrorHandler * errHandler;
97  DOMDocument * document;
100 
101  //
102  //_____ following removed as a xalan-c component_____________________
103  //
104  // xalan objects for XPath
105  //XalanSourceTreeInit * theSourceTreeInit;
106  //XalanSourceTreeDOMSupport * theDOMSupport;
107  //XalanSourceTreeParserLiaison * theLiaison;
108  //const LocalFileInputSource * theInputSource;
109  //XalanDocument * theDocument;
110  //XalanDocumentPrefixResolver * thePrefixResolver;
111  //XPathEvaluator * theEvaluator;
112 
113 };
114 
115 
116 #endif
std::string * the_string
Definition: XMLDOMBlock.h:99
int write(std::string target="stdout")
Definition: XMLDOMBlock.cc:322
DOMDocument * document
Definition: XMLDOMBlock.h:97
list parent
Definition: dbtoconf.py:74
XMLProcessor * theProcessor
Definition: XMLDOMBlock.h:94
std::string getTimestamp(time_t _time)
Definition: XMLDOMBlock.cc:446
DOMDocument * getDocumentConst(void) const
Definition: XMLDOMBlock.cc:317
#define NULL
Definition: scimark2.h:8
std::string theFileName
Definition: XMLDOMBlock.h:98
std::string & getString(void)
Definition: XMLDOMBlock.cc:459
DOMDocument * getDocument(void)
Definition: XMLDOMBlock.cc:312
virtual ~XMLDOMBlock()
Definition: XMLDOMBlock.cc:329
DOMDocument * getNewDocument(std::string xmlFileName)
Definition: XMLDOMBlock.cc:266
XercesDOMParser * parser
Definition: XMLDOMBlock.h:95
XMLDOMBlock & operator+=(const XMLDOMBlock &other)
Definition: XMLDOMBlock.cc:35
int init(std::string _root)
Definition: XMLDOMBlock.cc:167
ErrorHandler * errHandler
Definition: XMLDOMBlock.h:96
DOMElement * add_element(DOMElement *parent, XMLCh *tagname, XMLCh *value)
Definition: XMLDOMBlock.cc:523
void parse(InputSource &_source)
Definition: XMLDOMBlock.cc:122
const char * getTagValue(const std::string &tagName, int _item=0, DOMDocument *_document=NULL)
Definition: XMLDOMBlock.cc:350
DOMNode * setTagValue(const std::string &tagName, const std::string &tagValue, int _item=0, DOMDocument *_document=NULL)
Definition: XMLDOMBlock.cc:364
Helper class to handle FWLite file input sources.
DOMNode * setTagAttribute(const std::string &tagName, const std::string &attrName, const std::string &attrValue, int _item=0)
Definition: XMLDOMBlock.cc:408
const char * getTagAttribute(const std::string &tagName, const std::string &attrName, int _item=0)
Definition: XMLDOMBlock.cc:400