test
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 
40 class XMLProcessor;
41 
43 {
44 
45  friend class XMLProcessor;
46 
47  public:
48 
49  XMLDOMBlock();
50  XMLDOMBlock( std::string xmlFileName ); // create XML from template file
51  XMLDOMBlock( XERCES_CPP_NAMESPACE::InputSource & _source );
52  XMLDOMBlock( std::string _root, int rootElementName ); // create XML from scratch, second parameter is a dummy
53 
54  XERCES_CPP_NAMESPACE::DOMDocument * getDocument( void );
55  XERCES_CPP_NAMESPACE::DOMDocument * getDocumentConst( void ) const;
56  XERCES_CPP_NAMESPACE::DOMDocument * getNewDocument( std::string xmlFileName );
57  std::string & getString( void );
58  std::string & getString( XERCES_CPP_NAMESPACE::DOMNode * _node );
59  int write( std::string target = "stdout" );
60  virtual ~XMLDOMBlock();
61 
62  const char * getTagValue( const std::string & tagName, int _item = 0, XERCES_CPP_NAMESPACE::DOMDocument * _document = NULL );
63  const char * getTagValue( const std::string & tagName, int _item, XERCES_CPP_NAMESPACE::DOMElement * _document );
64  const char * getTagAttribute( const std::string & tagName, const std::string & attrName, int _item = 0 );
65 
66  XERCES_CPP_NAMESPACE::DOMElement * add_element(XERCES_CPP_NAMESPACE::DOMElement * parent, XMLCh * tagname, XMLCh * value);
67 
68  XERCES_CPP_NAMESPACE::DOMNode * setTagValue( const std::string & tagName, const std::string & tagValue, int _item = 0, XERCES_CPP_NAMESPACE::DOMDocument * _document = NULL );
69  XERCES_CPP_NAMESPACE::DOMNode * setTagValue( XERCES_CPP_NAMESPACE::DOMElement * _elem, const std::string & tagName, const std::string & tagValue, int _item = 0 );
70  XERCES_CPP_NAMESPACE::DOMNode * setTagValue( const std::string & tagName, const int & tagValue, int _item = 0, XERCES_CPP_NAMESPACE::DOMDocument * _document = NULL );
71  XERCES_CPP_NAMESPACE::DOMNode * setTagValue( XERCES_CPP_NAMESPACE::DOMElement * _elem, const std::string & tagName, const int & tagValue, int _item = 0 );
72  XERCES_CPP_NAMESPACE::DOMNode * setTagAttribute( const std::string & tagName, const std::string & attrName, const std::string & attrValue, int _item = 0 );
73  XERCES_CPP_NAMESPACE::DOMNode * setTagAttribute( XERCES_CPP_NAMESPACE::DOMElement * _elem, const std::string & tagName, const std::string & attrName, const std::string & attrValue, int _item = 0);
74  XERCES_CPP_NAMESPACE::DOMNode * setTagAttribute( const std::string & tagName, const std::string & attrName, const int & attrValue, int _item = 0 );
75  XERCES_CPP_NAMESPACE::DOMNode * setTagAttribute( XERCES_CPP_NAMESPACE::DOMElement * _elem, const std::string & tagName, const std::string & attrName, const int & attrValue, int _item = 0);
76  std::string getTimestamp( time_t _time );
77 
78  void parse( XERCES_CPP_NAMESPACE::InputSource & _source );
79 
80  XMLDOMBlock & operator+=( const XMLDOMBlock & other);
81 
82  //
83  //_____ following removed as a xalan-c component_____________________
84  //
85  //===> Xalan-c (XPath) stuff
86  //int read_xml_file_xalan( std::string filename );
87  //const XObjectPtr eval_xpath( std::string context, std::string expression );
88 
89  protected:
90 
91  int init( std::string _root );
92 
94  XERCES_CPP_NAMESPACE::XercesDOMParser * parser;
95  XERCES_CPP_NAMESPACE::ErrorHandler * errHandler;
96  XERCES_CPP_NAMESPACE::DOMDocument * document;
99 
100  //
101  //_____ following removed as a xalan-c component_____________________
102  //
103  // xalan objects for XPath
104  //XalanSourceTreeInit * theSourceTreeInit;
105  //XalanSourceTreeDOMSupport * theDOMSupport;
106  //XalanSourceTreeParserLiaison * theLiaison;
107  //const LocalFileInputSource * theInputSource;
108  //XalanDocument * theDocument;
109  //XalanDocumentPrefixResolver * thePrefixResolver;
110  //XPathEvaluator * theEvaluator;
111 
112 };
113 
114 
115 #endif
std::string * the_string
Definition: XMLDOMBlock.h:98
XERCES_CPP_NAMESPACE::DOMDocument * document
Definition: XMLDOMBlock.h:96
int write(std::string target="stdout")
Definition: XMLDOMBlock.cc:322
XMLProcessor * theProcessor
Definition: XMLDOMBlock.h:93
XERCES_CPP_NAMESPACE::ErrorHandler * errHandler
Definition: XMLDOMBlock.h:95
std::string getTimestamp(time_t _time)
Definition: XMLDOMBlock.cc:446
XERCES_CPP_NAMESPACE::DOMDocument * getDocumentConst(void) const
Definition: XMLDOMBlock.cc:317
#define NULL
Definition: scimark2.h:8
std::string theFileName
Definition: XMLDOMBlock.h:97
std::string & getString(void)
Definition: XMLDOMBlock.cc:459
XERCES_CPP_NAMESPACE::DOMDocument * getDocument(void)
Definition: XMLDOMBlock.cc:312
virtual ~XMLDOMBlock()
Definition: XMLDOMBlock.cc:329
XERCES_CPP_NAMESPACE::DOMDocument * getNewDocument(std::string xmlFileName)
Definition: XMLDOMBlock.cc:266
XERCES_CPP_NAMESPACE::DOMNode * setTagValue(const std::string &tagName, const std::string &tagValue, int _item=0, XERCES_CPP_NAMESPACE::DOMDocument *_document=NULL)
XERCES_CPP_NAMESPACE::XercesDOMParser * parser
Definition: XMLDOMBlock.h:94
XMLDOMBlock & operator+=(const XMLDOMBlock &other)
Definition: XMLDOMBlock.cc:35
int init(std::string _root)
Definition: XMLDOMBlock.cc:167
XERCES_CPP_NAMESPACE::DOMElement * add_element(XERCES_CPP_NAMESPACE::DOMElement *parent, XMLCh *tagname, XMLCh *value)
Definition: XMLDOMBlock.cc:523
const char * getTagValue(const std::string &tagName, int _item=0, XERCES_CPP_NAMESPACE::DOMDocument *_document=NULL)
XERCES_CPP_NAMESPACE::DOMNode * setTagAttribute(const std::string &tagName, const std::string &attrName, const std::string &attrValue, int _item=0)
Definition: XMLDOMBlock.cc:408
void parse(XERCES_CPP_NAMESPACE::InputSource &_source)
Definition: XMLDOMBlock.cc:122
const char * getTagAttribute(const std::string &tagName, const std::string &attrName, int _item=0)
Definition: XMLDOMBlock.cc:400