9 using namespace xercesc;
13 inline std::string
_toString(
const XMLCh *toTranscode){
14 std::string
tmp(XMLString::transcode(toTranscode));
19 XMLCh* buff = XMLString::transcode(temp.c_str());
32 XMLPlatformUtils::Initialize();
34 catch (
const XMLException&
e) {
35 std::cout <<
"Xerces-c error in initialization \n"
36 <<
"Exception message is: \n"
52 bool well_formed_string;
54 if(!well_formed_string)
std::cout <<
"MiscalibReaderFromXML::getIntAttribute PROBLEMS ...!!!" << std::endl;
70 bool well_formed_string;
72 if(!well_formed_string)
std::cout <<
"MiscalibReaderFromXML::getFloatAttribute PROBLEMS ...!!!" << std::endl;
81 XercesDOMParser*
parser =
new XercesDOMParser;
82 parser->setValidationScheme(XercesDOMParser::Val_Auto);
83 parser->setDoNamespaces(
false);
84 parser->parse(configFile.c_str());
85 DOMDocument*
doc = parser->getDocument();
88 unsigned int linkTagsNum = doc->getElementsByTagName(
_toDOMS(
"Cell"))->getLength();
92 if(linkTagsNum==0)
std::cout <<
"Number of Cells in file is 0 - probably bad file format"<<std::endl;
95 for (
unsigned int i=0;
i<linkTagsNum;
i++){
98 DOMNode* linkNode = doc->getElementsByTagName(
_toDOMS(
"Cell"))->item(
i);
101 std::cout<<
"Node LINK does not exist, i="<<
i<<std::endl;
104 DOMElement* linkElement =
static_cast<DOMElement *
>(linkNode);
106 std::cout<<
"Element LINK does not exist, i="<<
i<<std::endl;
111 DOMNamedNodeMap *
attributes = linkNode->getAttributes();
static double getFloatAttribute(XERCES_CPP_NAMESPACE::DOMNamedNodeMap *attributes, std::string attr_name, bool &well_formed_string)
static int getIntAttribute(XERCES_CPP_NAMESPACE::DOMNamedNodeMap *attributes, std::string attr_name, bool &well_formed_string)
std::string _toString(const XMLCh *toTranscode)
CaloMiscalibMap & caloMap_
bool parseXMLMiscalibFile(std::string configFile)
MiscalibReaderFromXML(CaloMiscalibMap &)
virtual void addCell(const DetId &cell, float scaling_factor)=0
static int s_numberOfInstances
double getScalingFactor(XERCES_CPP_NAMESPACE::DOMNamedNodeMap *attribute)
double getFloatAttribute(XERCES_CPP_NAMESPACE::DOMNamedNodeMap *attribute, const std::string &attribute_name)
std::vector< std::vector< double > > tmp
XMLCh * _toDOMS(std::string temp)
virtual DetId parseCellEntry(XERCES_CPP_NAMESPACE::DOMNamedNodeMap *attribute)=0
int getIntAttribute(XERCES_CPP_NAMESPACE::DOMNamedNodeMap *attribute, const std::string &attribute_name)