6 #include <xercesc/dom/DOMNode.hpp>
7 #include <xercesc/dom/DOM.hpp>
8 #include <xercesc/dom/DOMCharacterData.hpp>
9 #include <xercesc/parsers/XercesDOMParser.hpp>
10 #include <xercesc/util/PlatformUtils.hpp>
11 #include <xercesc/framework/LocalFileFormatTarget.hpp>
12 #include <xercesc/util/XMLUni.hpp>
13 #include <xercesc/util/XMLURL.hpp>
20 using namespace xercesc;
30 int nn = newfile0.size();
32 for (
int i = 0;
i < nn;
i++)
34 newfile[
i]=newfile0[
i];
36 char const* fend=
"\0";
39 cout<<
" New file "<<newfile<<endl;
47 XMLString::transcode (
"Core",tempStr,99);
48 mDom = DOMImplementationRegistry::getDOMImplementation (tempStr);
50 XMLString::transcode(
"CalibrationConstants", tempStr, 99);
51 mDoc = mDom->createDocument(
57 DOMWriter* domWriter = mDom->createDOMWriter();
58 domWriter->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint,
true);
59 DOMElement*
root = mDoc->getDocumentElement();
61 XMLString::transcode(
"Hcal", tempStr, 99);
62 DOMElement* rootelem = mDoc->createElement (tempStr);
63 root->appendChild(rootelem);
65 XMLString::transcode(
"Cell", tempStr, 99);
66 vector<DOMElement*> theDOMVec;
68 for(
unsigned int i=0;
i<detvec.size();
i++)
70 theDOMVec.push_back(mDoc->createElement (tempStr));
71 newCellLine(theDOMVec[
i],detvec[i],etavec[i],phivec[i],depthvec[i],scalevec[i]);
72 rootelem->appendChild(theDOMVec[i]);
75 cout<<
" Write Doc "<<theDOMVec.size()<<endl;
76 domWriter->writeNode (&formTarget, *mDoc);
77 cout<<
" End of Writting "<<endl;
84 XMLString::transcode(
"det_index", tempStr, 99);
85 DOMAttr* attrdet = mDoc->createAttribute(tempStr);
87 XMLString::transcode(
"eta_index", tempStr, 99);
88 DOMAttr* attreta = mDoc->createAttribute(tempStr);
90 XMLString::transcode(
"phi_index", tempStr, 99);
91 DOMAttr* attrphi = mDoc->createAttribute(tempStr) ;
93 XMLString::transcode(
"depth_index", tempStr, 99);
94 DOMAttr* attrdepth = mDoc->createAttribute(tempStr) ;
96 XMLString::transcode(
"scale_factor", tempStr, 99);
97 DOMAttr* attrscale = mDoc->createAttribute(tempStr) ;
101 attrdet->setValue(XMLString::transcode(ost.str().c_str()));
102 detelem->setAttributeNode(attrdet);
106 attreta->setValue(XMLString::transcode(ost1.str().c_str()));
108 detelem->setAttributeNode(attreta);
112 attrphi->setValue(XMLString::transcode(ost2.str().c_str()));
114 detelem->setAttributeNode(attrphi);
118 attrdepth->setValue(XMLString::transcode(ost3.str().c_str()));
120 detelem->setAttributeNode(attrdepth);
124 attrscale->setValue(XMLString::transcode(ost4.str().c_str()));
126 detelem->setAttributeNode(attrscale);
void newCellLine(xercesc::DOMElement *, int, int, int, int, float)
void writeXML(std::string &, std::vector< int >, std::vector< int >, std::vector< int >, std::vector< int >, std::vector< float >)
virtual ~HcalConstantsXMLWriter()
string root
initialization