10 using namespace xercesc;
20 XMLCh* buff = XMLString::transcode(temp.c_str());
30 }
catch (
const XMLException&
e) {
31 std::cout <<
"Xerces-c error in initialization \n"
32 <<
"Exception message is: \n"
33 <<
_toString(e.getMessage()) << std::endl;
42 bool well_formed_string;
44 if (!well_formed_string)
45 std::cout <<
"MiscalibReaderFromXML::getIntAttribute PROBLEMS ...!!!" << std::endl;
59 bool well_formed_string;
61 if (!well_formed_string)
62 std::cout <<
"MiscalibReaderFromXML::getFloatAttribute PROBLEMS ...!!!" << std::endl;
70 XercesDOMParser*
parser =
new XercesDOMParser;
71 parser->setValidationScheme(XercesDOMParser::Val_Auto);
72 parser->setDoNamespaces(
false);
73 parser->parse(configFile.c_str());
74 DOMDocument* doc = parser->getDocument();
77 unsigned int linkTagsNum = doc->getElementsByTagName(
_toDOMS(
"Cell"))->getLength();
82 std::cout <<
"Number of Cells in file is 0 - probably bad file format" << std::endl;
85 for (
unsigned int i = 0;
i < linkTagsNum;
i++) {
86 DOMNode* linkNode = doc->getElementsByTagName(
_toDOMS(
"Cell"))->item(
i);
89 std::cout <<
"Node LINK does not exist, i=" <<
i << std::endl;
92 DOMElement* linkElement =
static_cast<DOMElement*
>(linkNode);
94 std::cout <<
"Element LINK does not exist, i=" <<
i << std::endl;
98 DOMNamedNodeMap* attributes = linkNode->getAttributes();
103 if (cell !=
DetId(0)) {
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)
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)