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 // $Id: XMLDOMBlock.h,v 1.3 2010/08/06 20:24:02 wmtan Exp $
20 //
21 
22 
23 #include <boost/shared_ptr.hpp>
24 #include <string>
25 #include <xercesc/parsers/XercesDOMParser.hpp>
26 #include <xercesc/sax/HandlerBase.hpp>
27 #include <xercesc/dom/DOM.hpp>
28 
29 //
30 //_____ following removed as a xalan-c component_____________________
31 //
32 //#include <xalanc/DOMSupport/XalanDocumentPrefixResolver.hpp>
34 //#include <xalanc/XalanSourceTree/XalanSourceTreeDOMSupport.hpp>
35 //#include <xalanc/XalanSourceTree/XalanSourceTreeInit.hpp>
36 //#include <xalanc/XalanSourceTree/XalanSourceTreeParserLiaison.hpp>
37 //#include <xercesc/framework/LocalFileInputSource.hpp>
38 //#include <xalanc/XPath/XPathEvaluator.hpp>
39 
40 XERCES_CPP_NAMESPACE_USE
41 
42 class XMLProcessor;
43 
45 {
46 
47  friend class XMLProcessor;
48 
49  public:
50 
51  XMLDOMBlock();
52  XMLDOMBlock( std::string xmlFileName ); // create XML from template file
53  XMLDOMBlock( InputSource & _source );
54  XMLDOMBlock( std::string _root, int rootElementName ); // create XML from scratch, second parameter is a dummy
55 
56  DOMDocument * getDocument( void );
57  DOMDocument * getDocumentConst( void ) const;
58  DOMDocument * getNewDocument( std::string xmlFileName );
59  std::string & getString( void );
60  std::string & getString( DOMNode * _node );
61  int write( std::string target = "stdout" );
62  virtual ~XMLDOMBlock();
63 
64  const char * getTagValue( const std::string & tagName, int _item = 0, DOMDocument * _document = NULL );
65  const char * getTagValue( const std::string & tagName, int _item, DOMElement * _document );
66  const char * getTagAttribute( const std::string & tagName, const std::string & attrName, int _item = 0 );
67 
68  DOMElement * add_element(DOMElement * parent, XMLCh * tagname, XMLCh * value);
69 
70  DOMNode * setTagValue( const std::string & tagName, const std::string & tagValue, int _item = 0, DOMDocument * _document = NULL );
71  DOMNode * setTagValue( DOMElement * _elem, const std::string & tagName, const std::string & tagValue, int _item = 0 );
72  DOMNode * setTagValue( const std::string & tagName, const int & tagValue, int _item = 0, DOMDocument * _document = NULL );
73  DOMNode * setTagValue( DOMElement * _elem, const std::string & tagName, const int & tagValue, int _item = 0 );
74  DOMNode * setTagAttribute( const std::string & tagName, const std::string & attrName, const std::string & attrValue, int _item = 0 );
75  DOMNode * setTagAttribute( DOMElement * _elem, const std::string & tagName, const std::string & attrName, const std::string & attrValue, int _item = 0);
76  DOMNode * setTagAttribute( const std::string & tagName, const std::string & attrName, const int & attrValue, int _item = 0 );
77  DOMNode * setTagAttribute( DOMElement * _elem, const std::string & tagName, const std::string & attrName, const int & attrValue, int _item = 0);
78  std::string getTimestamp( time_t _time );
79 
80  void parse( InputSource & _source );
81 
82  XMLDOMBlock & operator+=( const XMLDOMBlock & other);
83 
84  //
85  //_____ following removed as a xalan-c component_____________________
86  //
87  //===> Xalan-c (XPath) stuff
88  //int read_xml_file_xalan( std::string filename );
89  //const XObjectPtr eval_xpath( std::string context, std::string expression );
90 
91  protected:
92 
93  int init( std::string _root );
94 
96  XercesDOMParser * parser;
97  ErrorHandler * errHandler;
98  DOMDocument * document;
101 
102  //
103  //_____ following removed as a xalan-c component_____________________
104  //
105  // xalan objects for XPath
106  //XalanSourceTreeInit * theSourceTreeInit;
107  //XalanSourceTreeDOMSupport * theDOMSupport;
108  //XalanSourceTreeParserLiaison * theLiaison;
109  //const LocalFileInputSource * theInputSource;
110  //XalanDocument * theDocument;
111  //XalanDocumentPrefixResolver * thePrefixResolver;
112  //XPathEvaluator * theEvaluator;
113 
114 };
115 
116 
117 #endif
std::string * the_string
Definition: XMLDOMBlock.h:100
int write(std::string target="stdout")
Definition: XMLDOMBlock.cc:323
DOMDocument * document
Definition: XMLDOMBlock.h:98
list parent
Definition: dbtoconf.py:74
XMLProcessor * theProcessor
Definition: XMLDOMBlock.h:95
std::string getTimestamp(time_t _time)
Definition: XMLDOMBlock.cc:447
DOMDocument * getDocumentConst(void) const
Definition: XMLDOMBlock.cc:318
#define NULL
Definition: scimark2.h:8
std::string theFileName
Definition: XMLDOMBlock.h:99
std::string & getString(void)
Definition: XMLDOMBlock.cc:460
DOMDocument * getDocument(void)
Definition: XMLDOMBlock.cc:313
virtual ~XMLDOMBlock()
Definition: XMLDOMBlock.cc:330
DOMDocument * getNewDocument(std::string xmlFileName)
Definition: XMLDOMBlock.cc:267
XercesDOMParser * parser
Definition: XMLDOMBlock.h:96
XMLDOMBlock & operator+=(const XMLDOMBlock &other)
Definition: XMLDOMBlock.cc:36
int init(std::string _root)
Definition: XMLDOMBlock.cc:168
ErrorHandler * errHandler
Definition: XMLDOMBlock.h:97
DOMElement * add_element(DOMElement *parent, XMLCh *tagname, XMLCh *value)
Definition: XMLDOMBlock.cc:524
void parse(InputSource &_source)
Definition: XMLDOMBlock.cc:123
const char * getTagValue(const std::string &tagName, int _item=0, DOMDocument *_document=NULL)
Definition: XMLDOMBlock.cc:351
DOMNode * setTagValue(const std::string &tagName, const std::string &tagValue, int _item=0, DOMDocument *_document=NULL)
Definition: XMLDOMBlock.cc:365
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:409
const char * getTagAttribute(const std::string &tagName, const std::string &attrName, int _item=0)
Definition: XMLDOMBlock.cc:401