5 #include <xercesc/dom/DOMNode.hpp> 6 #include <xercesc/dom/DOM.hpp> 7 #include <xercesc/parsers/XercesDOMParser.hpp> 10 #include <xercesc/util/XMLString.hpp> 11 #include <xercesc/sax/SAXException.hpp> 12 #include <xercesc/framework/LocalFileFormatTarget.hpp> 30 XercesDOMParser*
parser =
new XercesDOMParser;
31 parser->setValidationScheme( XercesDOMParser::Val_Never );
32 parser->setDoNamespaces(
false );
33 parser->setDoSchema(
false );
35 parser->parse(filename.c_str());
37 DOMDocument* xmlDoc = parser->getDocument();
41 std::cout <<
"EcalClusterCrackCorrXMLTranslator::Error parsing document" << std::endl;
45 DOMElement* elementRoot = xmlDoc->getDocumentElement();
61 unique_ptr<DOMImplementation>
impl( DOMImplementationRegistry::getDOMImplementation(
cms::xerces::uStr(
"LS").ptr()));
63 DOMLSSerializer*
writer = impl->createLSSerializer();
64 if( writer->getDomConfig()->canSetParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true ))
65 writer->getDomConfig()->setParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true );
67 DOMDocumentType* doctype =
69 const std::string EcalClusterCrackCorr_tag(
"EcalClusterCrackCorr");
71 impl->createDocument(
nullptr,
cms::xerces::uStr(EcalClusterCrackCorr_tag.c_str()).ptr(), doctype );
73 DOMElement*
root = doc->getDocumentElement();
76 const std::string ECCC_tag[4] = {
"IPCloseEtaSide",
"IPFarEtaSide",
77 "IPClosePhiSide",
"IPFarPhiSide"};;
79 for ( EcalFunctionParameters::const_iterator it = record.
params().begin(); it != record.
params().end(); ++it ) {
83 std::stringstream
out;
89 root->appendChild(ECCC);
111 std::fstream fs(filename.c_str(),
ios::out);
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
const std::string Value_tag("Value")
static int readXML(const std::string &filename, EcalCondHeader &header, EcalFunParams &record)
std::string toString(XMLCh const *toTranscode)
void readHeader(xercesc::DOMNode *parentNode, EcalCondHeader &header)
read header from
EcalFunctionParameters & params()
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
ZStr< XMLCh > uStr(char const *str)
static int writeXML(const std::string &filename, const EcalCondHeader &header, const EcalFunParams &record)
static std::string dumpXML(const EcalCondHeader &header, const EcalFunParams &record)