#include <EcalADCToGeVXMLTranslator.h>
Static Public Member Functions | |
static std::string | dumpXML (const EcalCondHeader &header, const EcalADCToGeVConstant &record) |
static int | readXML (const std::string &filename, EcalCondHeader &header, EcalADCToGeVConstant &record) |
static int | writeXML (const std::string &filename, const EcalCondHeader &header, const EcalADCToGeVConstant &record) |
Definition at line 25 of file EcalADCToGeVXMLTranslator.h.
std::string EcalADCToGeVXMLTranslator::dumpXML | ( | const EcalCondHeader & | header, |
const EcalADCToGeVConstant & | record | ||
) | [static] |
Definition at line 81 of file EcalADCToGeVXMLTranslator.cc.
References xuti::ADCToGeVConstant_tag(), xuti::Barrel_tag(), asciidump::doc, hcal_timing_source_file_cfg::dump, xuti::Endcap_tag(), xuti::fromNative(), EcalADCToGeVConstant::getEBValue(), EcalADCToGeVConstant::getEEValue(), dbtoconf::root, AlCaHLTBitMon_QueryRunRegistry::string, xuti::toNative(), xuti::writeHeader(), and xuti::WriteNodeWithValue().
{ XMLPlatformUtils::Initialize(); DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(fromNative("LS").c_str()); DOMWriter* writer =static_cast<DOMImplementationLS*>(impl)->createDOMWriter( ); writer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true); DOMDocumentType* doctype = impl->createDocumentType(fromNative("XML").c_str(), 0, 0 ); DOMDocument * doc = impl->createDocument( 0, fromNative(ADCToGeVConstant_tag).c_str(), doctype ); doc->setEncoding(fromNative("UTF-8").c_str() ); doc->setStandalone(true); doc->setVersion(fromNative("1.0").c_str() ); DOMElement* root = doc->getDocumentElement(); xuti::writeHeader(root,header); xuti::WriteNodeWithValue(root,Barrel_tag,record.getEBValue()); xuti::WriteNodeWithValue(root,Endcap_tag,record.getEEValue()); std::string dump= toNative(writer->writeToString(*root)); doc->release(); // XMLPlatformUtils::Terminate(); return dump; }
int EcalADCToGeVXMLTranslator::readXML | ( | const std::string & | filename, |
EcalCondHeader & | header, | ||
EcalADCToGeVConstant & | record | ||
) | [static] |
Definition at line 23 of file EcalADCToGeVXMLTranslator.cc.
References xuti::Barrel_tag(), gather_cfg::cout, xuti::Endcap_tag(), xuti::getChildNode(), xuti::GetNodeData(), geometryXMLtoCSV::parser, xuti::readHeader(), EcalADCToGeVConstant::setEBValue(), and EcalADCToGeVConstant::setEEValue().
{ XMLPlatformUtils::Initialize(); XercesDOMParser* parser = new XercesDOMParser; parser->setValidationScheme( XercesDOMParser::Val_Never ); parser->setDoNamespaces( false ); parser->setDoSchema( false ); parser->parse(filename.c_str()); DOMDocument* xmlDoc = parser->getDocument(); if (!xmlDoc) { std::cout << "EcalADCToGeVXMLTranslator::Error parsing document" << std::endl; return -1; } // Get the top-level element DOMElement* elementRoot = xmlDoc->getDocumentElement(); xuti::readHeader(elementRoot, header); DOMNode * barrelnode = xuti::getChildNode(elementRoot,Barrel_tag); DOMNode * endcapnode = xuti::getChildNode(elementRoot,Endcap_tag); double barrelvalue=0; double endcapvalue=0; xuti::GetNodeData(barrelnode,barrelvalue); xuti::GetNodeData(endcapnode,endcapvalue); record.setEBValue(barrelvalue); record.setEEValue(endcapvalue); delete parser; XMLPlatformUtils::Terminate(); return 0; }
int EcalADCToGeVXMLTranslator::writeXML | ( | const std::string & | filename, |
const EcalCondHeader & | header, | ||
const EcalADCToGeVConstant & | record | ||
) | [static] |
Definition at line 72 of file EcalADCToGeVXMLTranslator.cc.
References EcalCondTools::dumpXML(), and dbtoconf::out.