5 #include <xercesc/dom/DOMNode.hpp> 6 #include <xercesc/dom/DOM.hpp> 7 #include <xercesc/parsers/XercesDOMParser.hpp> 8 #include <xercesc/util/XMLString.hpp> 9 #include <xercesc/sax/SAXException.hpp> 10 #include <xercesc/framework/LocalFileFormatTarget.hpp> 28 XercesDOMParser*
parser =
new XercesDOMParser;
29 parser->setValidationScheme( XercesDOMParser::Val_Never );
30 parser->setDoNamespaces(
false );
31 parser->setDoSchema(
false );
33 parser->parse(filename.c_str());
35 DOMDocument* xmlDoc = parser->getDocument();
39 std::cout <<
"EcalClusterLocalContCorrXMLTranslator::Error parsing document" << std::endl;
43 DOMElement* elementRoot = xmlDoc->getDocumentElement();
58 unique_ptr<DOMImplementation>
impl( DOMImplementationRegistry::getDOMImplementation(
cms::xerces::uStr(
"LS").ptr()));
60 DOMLSSerializer*
writer = impl->createLSSerializer();
61 if( writer->getDomConfig()->canSetParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true ))
62 writer->getDomConfig()->setParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true );
64 DOMDocumentType* doctype = impl->createDocumentType(
cms::xerces::uStr(
"XML").ptr(),
nullptr,
nullptr );
66 DOMDocument*
doc = impl->createDocument(
nullptr,
cms::xerces::uStr(
"EcalClusterLocalContCorr").ptr(), doctype );
68 DOMElement*
root = doc->getDocumentElement();
71 for(
auto it : record.
params()) {
73 root->getOwnerDocument()->createElement(
cms::xerces::uStr(
"ClusterLocal").ptr());
74 root->appendChild(ECEC);
95 std::fstream fs(filename.c_str(),
ios::out);
static int readXML(const std::string &filename, EcalCondHeader &header, EcalFunParams &record)
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
const std::string Value_tag("Value")
static int writeXML(const std::string &filename, const EcalCondHeader &header, const EcalFunParams &record)
std::string toString(XMLCh const *toTranscode)
void readHeader(xercesc::DOMNode *parentNode, EcalCondHeader &header)
read header from
static std::string dumpXML(const EcalCondHeader &header, const EcalFunParams &record)
EcalFunctionParameters & params()
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
ZStr< XMLCh > uStr(char const *str)