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> 27 XercesDOMParser*
parser =
new XercesDOMParser;
28 parser->setValidationScheme( XercesDOMParser::Val_Never );
29 parser->setDoNamespaces(
false );
30 parser->setDoSchema(
false );
32 parser->parse(filename.c_str());
34 DOMDocument* xmlDoc = parser->getDocument();
36 std::cout <<
"EcalTimeBiasCorrectionsXMLTranslator::Error parsing document" << std::endl;
41 DOMElement* elementRoot = xmlDoc->getDocumentElement();
55 std::fstream fs(filename.c_str(),
ios::out);
66 unique_ptr<DOMImplementation>
impl( DOMImplementationRegistry::getDOMImplementation(
cms::xerces::uStr(
"LS").ptr()));
68 DOMLSSerializer*
writer = impl->createLSSerializer();
69 if( writer->getDomConfig()->canSetParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true ))
70 writer->getDomConfig()->setParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true );
72 DOMDocumentType* doctype = impl->createDocumentType(
cms::xerces::uStr(
"XML").ptr(),
nullptr,
nullptr );
75 DOMElement*
root = doc->getDocumentElement();
80 std::vector<float>::iterator it;
85 root->getOwnerDocument()->createElement(
cms::xerces::uStr(ETCAB_tag.c_str()).ptr());
86 root->appendChild(ETCAB);
87 for (it = vect.begin(); it != vect.end(); it++ ) {
93 ETCAB_tag =
"EBTimeCorrShiftBins";
95 ETCAB = root->getOwnerDocument()->createElement(
cms::xerces::uStr(ETCAB_tag.c_str()).ptr());
96 root->appendChild(ETCAB);
97 for (it = vect.begin(); it != vect.end(); it++ ) {
103 ETCAB_tag =
"EETimeCorrAmplitudeBins";
105 ETCAB = root->getOwnerDocument()->createElement(
cms::xerces::uStr(ETCAB_tag.c_str()).ptr());
106 root->appendChild(ETCAB);
107 for (it = vect.begin(); it != vect.end(); it++ ) {
113 ETCAB_tag =
"EETimeCorrShiftBins";
115 ETCAB = root->getOwnerDocument()->createElement(
cms::xerces::uStr(ETCAB_tag.c_str()).ptr());
116 root->appendChild(ETCAB);
117 for (it = vect.begin(); it != vect.end(); it++ ) {
static int readXML(const std::string &filename, EcalCondHeader &header, EcalTimeBiasCorrections &record)
std::vector< float > EBTimeCorrShiftBins
static int writeXML(const std::string &filename, const EcalCondHeader &header, const EcalTimeBiasCorrections &record)
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
const std::string Value_tag("Value")
std::vector< float > EBTimeCorrAmplitudeBins
std::vector< float > EETimeCorrShiftBins
std::string toString(XMLCh const *toTranscode)
const std::string IntercalibConstants_tag("EcalIntercalibConstants")
void readHeader(xercesc::DOMNode *parentNode, EcalCondHeader &header)
read header from
std::vector< float > EETimeCorrAmplitudeBins
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
ZStr< XMLCh > uStr(char const *str)
static std::string dumpXML(const EcalCondHeader &header, const EcalTimeBiasCorrections &record)