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> 30 std::cout <<
" TPGStripStatus should not be filled out from an xml file ..." << std::endl;
33 XercesDOMParser*
parser =
new XercesDOMParser;
34 parser->setValidationScheme( XercesDOMParser::Val_Never );
35 parser->setDoNamespaces(
false );
36 parser->setDoSchema(
false );
38 parser->parse(filename.c_str());
40 DOMDocument* xmlDoc = parser->getDocument();
42 std::cout <<
"EcalTPGStripStatusXMLTranslator::Error parsing document" << std::endl;
46 DOMElement* elementRoot = xmlDoc->getDocumentElement();
60 std::fstream fs(filename.c_str(),
ios::out);
70 unique_ptr<DOMImplementation>
impl( DOMImplementationRegistry::getDOMImplementation(
cms::xerces::uStr(
"LS").ptr()));
72 DOMLSSerializer*
writer = impl->createLSSerializer();
73 if( writer->getDomConfig()->canSetParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true ))
74 writer->getDomConfig()->setParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true );
76 DOMDocumentType* doctype = impl->createDocumentType(
cms::xerces::uStr(
"XML").ptr(),
nullptr,
nullptr );
79 DOMElement*
root = doc->getDocumentElement();
86 std::cout <<
"EcalTPGStripStatusXMLTranslator::dumpXML strip map size " << stripMap.size() << std::endl;
88 for(itSt = stripMap.begin(); itSt != stripMap.end(); ++itSt) {
89 if(itSt->second > 0) {
90 int tccid = itSt->first/8192 & 0x7F;
91 int tt = itSt->first/64 & 0x7F;
92 int pseudostrip = itSt->first/8 & 0x7;
96 DOMElement* cell_node =
107 value_s << pseudostrip;
110 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)
std::map< uint32_t, uint16_t >::const_iterator EcalTPGStripStatusMapIterator