4 #include <xercesc/dom/DOMNode.hpp>
5 #include <xercesc/dom/DOM.hpp>
6 #include <xercesc/parsers/XercesDOMParser.hpp>
7 #include <xercesc/util/PlatformUtils.hpp>
8 #include <xercesc/util/XMLString.hpp>
9 #include <xercesc/sax/SAXException.hpp>
10 #include <xercesc/framework/LocalFileFormatTarget.hpp>
22 using namespace XERCES_CPP_NAMESPACE;
29 std::fstream fs(filename.c_str(),
ios::out);
36 XMLPlatformUtils::Initialize();
37 DOMImplementation* impl =
38 DOMImplementationRegistry::getDOMImplementation(
fromNative(
"LS").c_str());
40 DOMWriter* writer =
static_cast<DOMImplementationLS*
>(impl)->createDOMWriter( );
41 writer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint,
true);
43 DOMDocumentType* doctype = impl->createDocumentType(
fromNative(
"XML").c_str(), 0, 0 );
47 doc->setEncoding(
fromNative(
"UTF-8").c_str() );
48 doc->setStandalone(
true);
51 DOMElement*
root = doc->getDocumentElement();
61 std::cout <<
"EcalTPGCrystalStatusXMLTranslator::dumpXML" << std::endl;
62 for (
int sign=0; sign <
kSides; sign++) {
63 int thesign = sign==1 ? 1:-1;
68 if(record[
id.rawId()].getStatusCode() > 0) {
79 if(record[
id.rawId()].getStatusCode() > 0) {
87 std::string
dump =
toNative(writer->writeToString(*root));
static std::string dumpXML(const EcalCondHeader &header, const EcalTPGCrystalStatus &record)
static const int kBarlRings
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
static const int kBarlWedges
static const int kEndcWedgesX
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
const std::string TPGCrystalStatus_tag("EcalTPGCrystalStatus")
static const int MAX_IPHI
static const int MAX_IETA
XercesString fromNative(const char *str)
static int writeXML(const std::string &filename, const EcalCondHeader &header, const EcalTPGCrystalStatus &record)
xercesc::DOMElement * writeCell(xercesc::DOMNode *node, const DetId &detid)
Append a Cell node with attributes to.
std::string toNative(const XMLCh *str)
string root
initialization
static const int kEndcWedgesY