CMS 3D CMS Logo

DQMParserBase.cc
Go to the documentation of this file.
3 
4 
5 #include <stdexcept>
14 using namespace xercesc;
15 
17  parser=0;
18 }
19 
21  delete parser;
22  parser=0;
23 }
24 
25 
26 void DQMParserBase::getDocument(std::string configFile, bool UseDB){
27 
28  parser = new XercesDOMParser;
29  parser->setValidationScheme(XercesDOMParser::Val_Auto);
30  parser->setDoNamespaces(false);
31  if(UseDB){
32 // std::cout<<"=== This is config file from getDocument ====== "<<std::endl;
33 // std::cout<<configFile<<std::endl;
34  MemBufInputSource mb((const XMLByte*)configFile.c_str(),strlen(configFile.c_str()),"",false);
35  parser->parse(mb);
36  }
37  else{
38  parser->parse(configFile.c_str());
39  }
40  xercesc::DOMDocument* doc = parser->getDocument();
41  assert(doc);
42 
43 }
44 
45 void DQMParserBase::getNewDocument(std::string configFile, bool UseDB){
46  parser->resetDocumentPool();
47  if(UseDB){
48  std::cout<<"=== This is config file from getNewDocument ==== "<<std::endl;
49  std::cout<<configFile<<std::endl;
50  MemBufInputSource mb((const XMLByte*)configFile.c_str(),strlen(configFile.c_str()),"",false);
51  parser->parse(mb);
52  }
53  else{
54  parser->parse(configFile.c_str());
55  }
56  xercesc::DOMDocument* doc = parser->getDocument();
57  assert(doc);
58 
59 }
61  unsigned int tagsNum =
62  parser->getDocument()->getElementsByTagName(qtxml::_toDOMS(tagName))->getLength();
63  return tagsNum;
64 }
void getDocument(std::string configFile, bool UseDB=false)
Methor that parses the xml file configFile.
int countNodes(std::string tagName)
Returns the number of nodes with given name.
void getNewDocument(std::string configFile, bool UseDB=false)
Parses a new Document.
DQMParserBase()
Creator.
virtual ~DQMParserBase()
Destructor.
XMLCh * _toDOMS(std::string temp)