CMS 3D CMS Logo

Static Public Member Functions

EcalClusterLocalContCorrXMLTranslator Class Reference

#include <EcalClusterLocalContCorrXMLTranslator.h>

List of all members.

Static Public Member Functions

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

Detailed Description

Translates a EcalClusterLocalContCorr record to XML and vice versa

Author:
Version:
Id:
EcalClusterLocalContCorrXMLTranslator.h,v 1.1 2011/11/10 17:54:20 fay Exp
Date:
October 2011

Definition at line 21 of file EcalClusterLocalContCorrXMLTranslator.h.


Member Function Documentation

std::string EcalClusterLocalContCorrXMLTranslator::dumpXML ( const EcalCondHeader header,
const EcalFunParams record 
) [static]

Definition at line 55 of file EcalClusterLocalContCorrXMLTranslator.cc.

References asciidump::doc, hcal_timing_source_file_cfg::dump, xuti::fromNative(), EcalFunParams::params(), dbtoconf::root, xuti::toNative(), xuti::Value_tag(), 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 );
  const  std::string EcalClusterLocalContCorr_tag("EcalClusterLocalContCorr");
  DOMDocument *    doc = 
    impl->createDocument( 0, fromNative(EcalClusterLocalContCorr_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);

  const std::string ECEC_tag("ClusterLocal");
  for ( EcalFunctionParameters::const_iterator it = record.params().begin(); it != record.params().end(); ++it ) {
    DOMElement* ECEC = 
      root->getOwnerDocument()->createElement( fromNative(ECEC_tag).c_str());
    root->appendChild(ECEC);

    WriteNodeWithValue(ECEC,Value_tag,*it);
  }

  std::string dump= toNative(writer->writeToString(*root));
  doc->release();
  return dump;
}
static int EcalClusterLocalContCorrXMLTranslator::readXML ( const std::string &  filename,
EcalCondHeader header,
EcalFunParams record 
) [static]
int EcalClusterLocalContCorrXMLTranslator::writeXML ( const std::string &  filename,
const EcalCondHeader header,
const EcalFunParams record 
) [static]

Definition at line 98 of file EcalClusterLocalContCorrXMLTranslator.cc.

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

                                           {

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