7 #include <xercesc/dom/DOMNode.hpp>
8 #include <xercesc/dom/DOM.hpp>
9 #include <xercesc/parsers/XercesDOMParser.hpp>
10 #include <xercesc/util/XMLString.hpp>
11 #include <xercesc/sax/SAXException.hpp>
12 #include <xercesc/framework/LocalFileFormatTarget.hpp>
31 XercesDOMParser*
parser =
new XercesDOMParser;
32 parser->setValidationScheme(XercesDOMParser::Val_Never);
33 parser->setDoNamespaces(
false);
34 parser->setDoSchema(
false);
38 DOMDocument* xmlDoc =
parser->getDocument();
40 std::cout <<
"EcalLaserAPDPNRatiosXMLTranslator::Error parsing document" << std::endl;
44 DOMElement* elementRoot = xmlDoc->getDocumentElement();
83 record.setValue(detid, pair);
85 cellnode = cellnode->getNextSibling();
87 while (cellnode && cellnode->getNodeType() != DOMNode::ELEMENT_NODE)
88 cellnode = cellnode->getNextSibling();
111 unique_ptr<DOMImplementation>
impl(DOMImplementationRegistry::getDOMImplementation(
cms::xerces::uStr(
"LS").ptr()));
113 DOMLSSerializer*
writer =
impl->createLSSerializer();
114 if (
writer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint,
true))
115 writer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint,
true);
117 DOMDocumentType* doctype =
impl->createDocumentType(
cms::xerces::uStr(
"XML").ptr(),
nullptr,
nullptr);
119 DOMElement*
root =
doc->getDocumentElement();
123 string Lasertag =
"Laser", LMtag =
"LM";
124 for (
int cellid = 0; cellid < (
int)
record.getTimeMap().size(); cellid++) {
126 root->appendChild(cellnode);
127 stringstream value_s;
132 t123[0] = (
record.getTimeMap())[cellid].
t1.value();
133 t123[1] = (
record.getTimeMap())[cellid].
t2.value();
134 t123[2] = (
record.getTimeMap())[cellid].
t3.value();
135 string Laser_t_tag[3] = {
"t1",
"t2",
"t3"};
136 for (
int i = 0;
i < 3;
i++) {
137 time_t
t = t123[
i] >> 32;
140 localtime_r(&
t, <);
141 strftime(
buf,
sizeof(
buf),
"%F %R:%S", <);
143 DOMDocument* subdoc = cellnode->getOwnerDocument();
144 DOMElement* new_node = subdoc->createElement(
cms::xerces::uStr(Laser_t_tag[
i].c_str()).ptr());
145 cellnode->appendChild(new_node);
146 std::stringstream value_ss;
148 string newstr = value_ss.str() +
" [" +
string(
buf) +
"]";
149 DOMText* tvalue = subdoc->createTextNode(
cms::xerces::uStr(newstr.c_str()).ptr());
150 new_node->appendChild(tvalue);