4 #include <xercesc/dom/DOMNode.hpp>
5 #include <xercesc/dom/DOM.hpp>
6 #include <xercesc/parsers/XercesDOMParser.hpp>
9 #include <xercesc/util/XMLString.hpp>
10 #include <xercesc/sax/SAXException.hpp>
11 #include <xercesc/framework/LocalFileFormatTarget.hpp>
22 using namespace XERCES_CPP_NAMESPACE;
29 std::cout <<
" TPGStripStatus should not be filled out from an xml file ..." << std::endl;
32 XercesDOMParser*
parser =
new XercesDOMParser;
33 parser->setValidationScheme(XercesDOMParser::Val_Never);
34 parser->setDoNamespaces(
false);
35 parser->setDoSchema(
false);
37 parser->parse(filename.c_str());
39 DOMDocument* xmlDoc = parser->getDocument();
41 std::cout <<
"EcalTPGStripStatusXMLTranslator::Error parsing document" << std::endl;
45 DOMElement* elementRoot = xmlDoc->getDocumentElement();
68 unique_ptr<DOMImplementation> impl(DOMImplementationRegistry::getDOMImplementation(
cms::xerces::uStr(
"LS").ptr()));
70 DOMLSSerializer* writer = impl->createLSSerializer();
71 if (writer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint,
true))
72 writer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint,
true);
74 DOMDocumentType* doctype = impl->createDocumentType(
cms::xerces::uStr(
"XML").ptr(),
nullptr,
nullptr);
76 DOMElement* root = doc->getDocumentElement();
83 std::cout <<
"EcalTPGStripStatusXMLTranslator::dumpXML strip map size " << stripMap.size() << std::endl;
85 for (itSt = stripMap.begin(); itSt != stripMap.end(); ++itSt) {
86 if (itSt->second > 0) {
87 int tccid = itSt->first / 8192 & 0x7F;
88 int tt = itSt->first / 64 & 0x7F;
89 int pseudostrip = itSt->first / 8 & 0x7;
101 value_s << pseudostrip;
103 root->appendChild(cell_node);
const std::map< uint32_t, uint16_t > & getMap() const
static int readXML(const std::string &filename, EcalCondHeader &header, EcalTPGStripStatus &record)
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
std::string toString(XMLCh const *toTranscode)
void readHeader(xercesc::DOMNode *parentNode, EcalCondHeader &header)
read header from
const std::string Cell_tag("cell")
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
ZStr< XMLCh > uStr(char const *str)
static std::string dumpXML(const EcalCondHeader &header, const EcalTPGStripStatus &record)
const std::string TPGStripStatus_tag("EcalTPGStripStatus")
std::map< uint32_t, uint16_t > EcalTPGStripStatusMap
static int writeXML(const std::string &filename, const EcalCondHeader &header, const EcalTPGStripStatus &record)
tuple dump
OutputFilePath = cms.string('/tmp/zhokin/'), OutputFileExt = cms.string(''),.
std::map< uint32_t, uint16_t >::const_iterator EcalTPGStripStatusMapIterator