4 #include <xercesc/dom/DOMNode.hpp>
5 #include <xercesc/dom/DOM.hpp>
6 #include <xercesc/parsers/XercesDOMParser.hpp>
8 #include <xercesc/util/XMLString.hpp>
9 #include <xercesc/sax/SAXException.hpp>
10 #include <xercesc/framework/LocalFileFormatTarget.hpp>
19 using namespace XERCES_CPP_NAMESPACE;
29 XercesDOMParser*
parser =
new XercesDOMParser;
30 parser->setValidationScheme( XercesDOMParser::Val_Never );
31 parser->setDoNamespaces(
false );
32 parser->setDoSchema(
false );
34 parser->parse(filename.c_str());
36 DOMDocument* xmlDoc = parser->getDocument();
38 std::cout <<
"EcalPulseShapesXMLTranslator::Error parsing document" << std::endl;
42 DOMElement* elementRoot = xmlDoc->getDocumentElement();
106 cellnode = cellnode->getNextSibling();
108 while(cellnode && cellnode->getNodeType() != DOMNode::ELEMENT_NODE)
109 cellnode = cellnode->getNextSibling();
115 std::cout <<
" nb of channels found in xml file " << chan << std::endl;
122 std::fstream fs(filename.c_str(),
ios::out);
131 DOMImplementation* impl =
132 DOMImplementationRegistry::getDOMImplementation(
fromNative(
"LS").c_str());
134 DOMWriter* writer =
static_cast<DOMImplementationLS*
>(impl)->createDOMWriter( );
135 writer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint,
true);
137 DOMDocumentType* doctype = impl->createDocumentType(
fromNative(
"XML").c_str(), 0, 0 );
141 doc->setEncoding(
fromNative(
"UTF-8").c_str() );
142 doc->setStandalone(
true);
145 DOMElement*
root = doc->getDocumentElement();
154 if (record.
find(rawid) == record.
end())
continue;
155 if(!record[rawid].pdfval[5])
continue;
157 DOMElement* cellnode=
writeCell(root,rawid);
182 if (record.
find(rawid) == record.
end())
continue;
183 if(!record[rawid].pdfval[5])
continue;
185 DOMElement* cellnode=
writeCell(root,rawid);
const std::string sample9_tag("sample_9")
const std::string sample10_tag("sample_10")
const std::string sample0_tag("sample_0")
const std::string PulseShapes_tag("EcalPulseShapes")
const std::string sample2_tag("sample_2")
const Items & barrelItems() const
static const int TEMPLATESAMPLES
const std::string sample11_tag("sample_11")
const std::string sample5_tag("sample_5")
static EEDetId unhashIndex(int hi)
const std::string sample7_tag("sample_7")
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
static bool validHashIndex(int i)
void readHeader(xercesc::DOMNode *parentNode, EcalCondHeader &header)
read header from
const std::string sample3_tag("sample_3")
static const int MIN_HASH
const std::string Cell_tag("cell")
const std::string sample8_tag("sample_8")
const std::string sample1_tag("sample_1")
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
static int readXML(const std::string &filename, EcalCondHeader &header, EcalPulseShapes &record)
void GetNodeData(xercesc::DOMNode *node, T &value)
get the node data
xercesc::DOMNode * getChildNode(xercesc::DOMNode *node, const std::string &nodename)
get the child of
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
static std::string dumpXML(const EcalCondHeader &header, const EcalPulseShapes &record)
static int writeXML(const std::string &filename, const EcalCondHeader &header, const EcalPulseShapes &record)
const_iterator find(uint32_t rawId) const
XercesString fromNative(const char *str)
const_iterator end() const
xercesc::DOMElement * writeCell(xercesc::DOMNode *node, const DetId &detid)
Append a Cell node with attributes to.
const std::string sample6_tag("sample_6")
const Items & endcapItems() const
const std::string sample4_tag("sample_4")
const DetId readCellId(xercesc::DOMElement *node)
Assuming.
std::string toNative(const XMLCh *str)