CMS 3D CMS Logo

Static Public Member Functions

ESGainXMLTranslator Class Reference

#include <ESGainXMLTranslator.h>

List of all members.

Static Public Member Functions

static std::string dumpXML (const EcalCondHeader &header, const ESGain &record)
static int writeXML (const std::string &filename, const EcalCondHeader &header, const ESGain &record)

Detailed Description

Definition at line 23 of file ESGainXMLTranslator.h.


Member Function Documentation

std::string ESGainXMLTranslator::dumpXML ( const EcalCondHeader header,
const ESGain record 
) [static]

Definition at line 30 of file ESGainXMLTranslator.cc.

References xuti::ADCToGeVConstant_tag(), asciidump::doc, hcal_timing_source_file_cfg::dump, xuti::ESGain_tag(), xuti::fromNative(), ESGain::getESGain(), 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,ESGain_tag,record.getESGain());

  std::string dump= toNative(writer->writeToString(*root)); 
  doc->release();

  //   XMLPlatformUtils::Terminate();

  return dump;
}
int ESGainXMLTranslator::writeXML ( const std::string &  filename,
const EcalCondHeader header,
const ESGain record 
) [static]

Definition at line 21 of file ESGainXMLTranslator.cc.

References EcalCondTools::dumpXML(), and dbtoconf::out.

                                                             {
  std::fstream fs(filename.c_str(),ios::out);
  fs<< dumpXML(header,record);
  return 0;  
 
}