#include <PhysicsTools/MVATrainer/interface/XMLDocument.h>
Public Member Functions | |
template<class T> | |
void | addAttribute (DOMElement *fElement, const std::string &fName, const T &fValue) |
void | addData (DOMElement *fData, const HcalGainWidth &fItem) |
void | addData (DOMElement *fData, const HcalRawGain &fItem) |
void | addData (DOMElement *fData, const HcalGain &fItem) |
void | addData (DOMElement *fData, const HcalPedestalWidth &fItem) |
void | addData (DOMElement *fData, const HcalPedestal &fItem) |
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * | createDocument (const std::string &root) |
const DOMDocument * | document () |
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * | getDocument () const |
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * | getRootNode () const |
DOMElement * | makeChId (DOMElement *fDataset, DetId fId) |
DOMElement * | makeData (DOMElement *fDataset) |
DOMElement * | makeData (DOMElement *fDataset, const HcalPedestal &fPed, const HcalPedestalWidth &fWidth) |
DOMElement * | makeDataset (DOMElement *fRoot, const std::string &fVersion) |
DOMElement * | makeElement (DOMElement *fRoot) |
DOMElement * | makeElementDataset (DOMElement *fElement, int fXMLId, DetId fDetId, const std::string &fVersion, const std::string &fKind, unsigned long fRun) |
DOMElement * | makeElementIOV (DOMElement *fElement, unsigned long long fIovBegin, unsigned long long fIovEnd=0) |
DOMElement * | makeElementTag (DOMElement *fElement, const std::string &fTagName, const std::string &fDetectorName, const std::string &fComment="Automatically created by HcalDbXml") |
DOMElement * | makeHeader (DOMElement *fRoot, const std::string &fExtensionName, unsigned long fRun) |
DOMElement * | makeMapDataset (DOMElement *fIov, int fXMLId) |
DOMElement * | makeMapIOV (DOMElement *fTag) |
DOMElement * | makeMaps (DOMElement *fRoot) |
DOMElement * | makeMapTag (DOMElement *fMap) |
DOMElement * | makeRun (DOMElement *fHeader, unsigned long fRun) |
DOMElement * | makeType (DOMElement *fHeader, const std::string &fExtensionName) |
template<class T> | |
DOMElement * | newElement (DOMElement *fParent, const T &fName) |
template<class T> | |
DOMElement * | newValue (DOMElement *fParent, const std::string &fName, const T &fValue) |
template<> | |
bool | readAttribute (XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *elem, const char *name, const bool &defValue) |
DOMElement * | root () |
void | streamOut (std::ostream &fOut) |
template<> | |
void | writeAttribute (XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *elem, const char *name, const bool &value) |
template<> | |
void | writeContent (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, const bool &value) |
XMLDocument (const std::string &fileName, bool write=false) | |
XMLDocument () | |
~XMLDocument () | |
Static Public Member Functions | |
static bool | hasAttribute (XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *elem, const char *name) |
template<typename T> | |
static T | readAttribute (XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *elem, const char *name, const T &defValue) |
template<typename T> | |
static T | readAttribute (XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *elem, const char *name) |
template<typename T> | |
static T | readContent (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node) |
template<typename T> | |
static void | writeAttribute (XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *elem, const char *name, const T &value) |
template<typename T> | |
static void | writeContent (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, const T &value) |
Private Member Functions | |
void | openForRead (const std::string &fileName) |
void | openForWrite (const std::string &fileName) |
Private Attributes | |
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * | doc |
std::auto_ptr < XERCES_CPP_NAMESPACE_QUALIFIER HandlerBase > | errHandler |
std::string | fileName |
XERCES_CPP_NAMESPACE_QUALIFIER DOMImplementation * | impl |
DOMDocument * | mDoc |
DOMImplementation * | mDom |
std::auto_ptr < XERCES_CPP_NAMESPACE_QUALIFIER XercesDOMParser > | parser |
std::auto_ptr< XercesPlatform > | platform |
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * | rootNode |
bool | write |
Classes | |
class | XercesPlatform |
Definition at line 54 of file HcalDbXml.cc.
XMLDocument::XMLDocument | ( | ) |
Definition at line 97 of file HcalDbXml.cc.
References mDoc, mDom, and transcode().
00098 : mDoc (0) 00099 { 00100 XMLPlatformUtils::Initialize(); 00101 mDom = DOMImplementationRegistry::getDOMImplementation (transcode ("Core")); 00102 mDoc = mDom->createDocument( 00103 0, // root element namespace URI. 00104 transcode ("ROOT"), // root element name 00105 0); // document type object (DTD). 00106 }
XMLDocument::XMLDocument | ( | const std::string & | fileName, | |
bool | write = false | |||
) |
Definition at line 57 of file XMLDocument.cc.
References openForRead(), and openForWrite().
00057 : 00058 platform(new XercesPlatform()), fileName(fileName), 00059 write(write), impl(0), doc(0), rootNode(0) 00060 { 00061 if (write) 00062 openForWrite(fileName); 00063 else 00064 openForRead(fileName); 00065 }
XMLDocument::~XMLDocument | ( | ) |
Definition at line 67 of file XMLDocument.cc.
References doc, fileName, impl, remove(), target, and write.
00068 { 00069 if (!write) 00070 return; 00071 00072 std::auto_ptr<DocReleaser> docReleaser(new DocReleaser(doc)); 00073 00074 std::auto_ptr<DOMWriter> writer(static_cast<DOMImplementationLS*>( 00075 impl)->createDOMWriter()); 00076 assert(writer.get()); 00077 00078 writer->setEncoding(XMLUniStr("UTF-8")); 00079 if (writer->canSetFeature(XMLUni::fgDOMWRTDiscardDefaultContent, true)) 00080 writer->setFeature(XMLUni::fgDOMWRTDiscardDefaultContent, true); 00081 if (writer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true)) 00082 writer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true); 00083 00084 try { 00085 std::auto_ptr<XMLFormatTarget> target( 00086 new LocalFileFormatTarget(fileName.c_str())); 00087 00088 writer->writeNode(target.get(), *doc); 00089 } catch(...) { 00090 std::remove(fileName.c_str()); 00091 throw; 00092 } 00093 }
void XMLDocument::addAttribute | ( | DOMElement * | fElement, | |
const std::string & | fName, | |||
const T & | fValue | |||
) | [inline] |
Definition at line 121 of file HcalDbXml.cc.
References transcode().
Referenced by makeElementDataset(), makeElementIOV(), makeElementTag(), makeMapDataset(), makeMapIOV(), and makeMapTag().
void XMLDocument::addData | ( | DOMElement * | fData, | |
const HcalGainWidth & | fItem | |||
) |
Definition at line 265 of file HcalDbXml.cc.
References HcalGainWidth::getValue(), and newValue().
00265 { 00266 newValue (fData, "CAPACITOR_0_ERROR", fItem.getValue (0)); 00267 newValue (fData, "CAPACITOR_1_ERROR", fItem.getValue (1)); 00268 newValue (fData, "CAPACITOR_2_ERROR", fItem.getValue (2)); 00269 newValue (fData, "CAPACITOR_3_ERROR", fItem.getValue (3)); 00270 }
void XMLDocument::addData | ( | DOMElement * | fData, | |
const HcalRawGain & | fItem | |||
) |
Definition at line 258 of file HcalDbXml.cc.
References HcalRawGain::getError(), HcalRawGain::getValue(), HcalRawGain::getVoltage(), newValue(), and HcalRawGain::strStatus().
00258 { 00259 newValue (fData, "VALUE", fItem.getValue ()); 00260 newValue (fData, "ERROR", fItem.getError ()); 00261 newValue (fData, "VOLTAGE", fItem.getVoltage ()); 00262 newValue (fData, "STATUS", fItem.strStatus ()); 00263 }
Definition at line 251 of file HcalDbXml.cc.
References HcalGain::getValue(), and newValue().
00251 { 00252 newValue (fData, "CAPACITOR_0_VALUE", fItem.getValue (0)); 00253 newValue (fData, "CAPACITOR_1_VALUE", fItem.getValue (1)); 00254 newValue (fData, "CAPACITOR_2_VALUE", fItem.getValue (2)); 00255 newValue (fData, "CAPACITOR_3_VALUE", fItem.getValue (3)); 00256 }
void XMLDocument::addData | ( | DOMElement * | fData, | |
const HcalPedestalWidth & | fItem | |||
) |
Definition at line 237 of file HcalDbXml.cc.
References HcalPedestalWidth::getSigma(), and newValue().
00237 { 00238 // widths 00239 newValue (fData, "SIGMA_0_0", fItem.getSigma (0, 0)); 00240 newValue (fData, "SIGMA_1_1", fItem.getSigma (1, 1)); 00241 newValue (fData, "SIGMA_2_2", fItem.getSigma (2, 2)); 00242 newValue (fData, "SIGMA_3_3", fItem.getSigma (3, 3)); 00243 newValue (fData, "SIGMA_0_1", fItem.getSigma (0, 1)); 00244 newValue (fData, "SIGMA_0_2", fItem.getSigma (0, 2)); 00245 newValue (fData, "SIGMA_0_3", fItem.getSigma (0, 3)); 00246 newValue (fData, "SIGMA_1_2", fItem.getSigma (1, 2)); 00247 newValue (fData, "SIGMA_1_3", fItem.getSigma (1, 3)); 00248 newValue (fData, "SIGMA_2_3", fItem.getSigma (2, 3)); 00249 }
void XMLDocument::addData | ( | DOMElement * | fData, | |
const HcalPedestal & | fItem | |||
) |
Definition at line 230 of file HcalDbXml.cc.
References HcalPedestal::getValue(), and newValue().
Referenced by dumpObject_().
00230 { 00231 newValue (fData, "CAPACITOR_0_VALUE", fItem.getValue (0)); 00232 newValue (fData, "CAPACITOR_1_VALUE", fItem.getValue (1)); 00233 newValue (fData, "CAPACITOR_2_VALUE", fItem.getValue (2)); 00234 newValue (fData, "CAPACITOR_3_VALUE", fItem.getValue (3)); 00235 }
DOMDocument * XMLDocument::createDocument | ( | const std::string & | root | ) |
Definition at line 147 of file XMLDocument.cc.
References doc, lat::endl(), Exception, impl, and rootNode.
00148 { 00149 if (doc) 00150 throw cms::Exception("XMLDocument") 00151 << "Document already exists in createDocument." 00152 << std::endl; 00153 00154 doc = impl->createDocument(0, XMLUniStr(root.c_str()), 0); 00155 rootNode = doc->getDocumentElement(); 00156 00157 return doc; 00158 }
const DOMDocument * XMLDocument::document | ( | ) |
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* XMLDocument::getDocument | ( | void | ) | const [inline] |
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement* XMLDocument::getRootNode | ( | ) | const [inline] |
bool XMLDocument::hasAttribute | ( | XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * | elem, | |
const char * | name | |||
) | [static] |
DOMElement * XMLDocument::makeChId | ( | DOMElement * | fDataset, | |
DetId | fId | |||
) |
Definition at line 154 of file HcalDbXml.cc.
References funct::abs(), eta, HcalText2DetIdConverter::getField(), HcalText2DetIdConverter::getField2(), HcalText2DetIdConverter::getField3(), HcalText2DetIdConverter::getFlavor(), newElement(), newValue(), parser, and DetId::rawId().
Referenced by dumpObject_(), and makeElementDataset().
00154 { 00155 DOMElement* channel = newElement (fDataset, "CHANNEL"); 00156 newValue (channel, "EXTENSION_TABLE_NAME", "HCAL_CHANNELS"); 00157 HcalText2DetIdConverter parser (fId); 00158 newValue (channel, "DETECTOR_NAME", parser.getFlavor ()); 00159 int eta = parser.getField (1); 00160 newValue (channel, "ETA", abs(eta)); 00161 newValue (channel, "Z", eta > 0 ? 1 : -1); 00162 newValue (channel, "PHI", parser.getField2 ()); 00163 newValue (channel, "DEPTH", parser.getField3 ()); 00164 newValue (channel, "HCAL_CHANNEL_ID", fId.rawId()); 00165 return channel; 00166 }
DOMElement * XMLDocument::makeData | ( | DOMElement * | fDataset | ) |
Definition at line 226 of file HcalDbXml.cc.
References newElement().
00226 { 00227 return newElement (fDataset, "DATA"); 00228 }
DOMElement * XMLDocument::makeData | ( | DOMElement * | fDataset, | |
const HcalPedestal & | fPed, | |||
const HcalPedestalWidth & | fWidth | |||
) |
Definition at line 273 of file HcalDbXml.cc.
References data, HcalPedestalWidth::getSigma(), HcalPedestal::getValue(), newElement(), and newValue().
Referenced by dumpObject_().
00273 { 00274 DOMElement* data = newElement (fDataset, "DATA"); 00275 // pedestals 00276 newValue (data, "CAPACITOR_0_VALUE", fPed.getValue (0)); 00277 newValue (data, "CAPACITOR_1_VALUE", fPed.getValue (1)); 00278 newValue (data, "CAPACITOR_2_VALUE", fPed.getValue (2)); 00279 newValue (data, "CAPACITOR_3_VALUE", fPed.getValue (3)); 00280 // widths 00281 newValue (data, "SIGMA_0_0", fWidth.getSigma (0, 0)); 00282 newValue (data, "SIGMA_1_1", fWidth.getSigma (1, 1)); 00283 newValue (data, "SIGMA_2_2", fWidth.getSigma (2, 2)); 00284 newValue (data, "SIGMA_3_3", fWidth.getSigma (3, 3)); 00285 newValue (data, "SIGMA_0_1", fWidth.getSigma (0, 1)); 00286 newValue (data, "SIGMA_0_2", fWidth.getSigma (0, 2)); 00287 newValue (data, "SIGMA_0_3", fWidth.getSigma (0, 3)); 00288 newValue (data, "SIGMA_1_2", fWidth.getSigma (1, 2)); 00289 newValue (data, "SIGMA_1_3", fWidth.getSigma (1, 3)); 00290 newValue (data, "SIGMA_2_3", fWidth.getSigma (2, 3)); 00291 return data; 00292 }
DOMElement * XMLDocument::makeDataset | ( | DOMElement * | fRoot, | |
const std::string & | fVersion | |||
) |
Definition at line 148 of file HcalDbXml.cc.
References ttbarGen_cfg::dataset, newElement(), and newValue().
Referenced by dumpObject_().
00148 { 00149 DOMElement* dataset =newElement (fRoot, "DATA_SET"); 00150 newValue (dataset, "VERSION", fVersion); 00151 return dataset; 00152 }
DOMElement * XMLDocument::makeElement | ( | DOMElement * | fRoot | ) |
Definition at line 198 of file HcalDbXml.cc.
References element(), and newElement().
Referenced by dumpObject_().
00198 { 00199 DOMElement* element = newElement (fRoot, "ELEMENTS"); 00200 return element; 00201 }
DOMElement * XMLDocument::makeElementDataset | ( | DOMElement * | fElement, | |
int | fXMLId, | |||
DetId | fDetId, | |||
const std::string & | fVersion, | |||
const std::string & | fKind, | |||
unsigned long | fRun | |||
) |
Definition at line 168 of file HcalDbXml.cc.
References addAttribute(), ttbarGen_cfg::dataset, makeChId(), makeRun(), newElement(), and newValue().
Referenced by dumpObject_().
00168 { 00169 DOMElement* dataset = newElement (fElement, "DATA_SET"); 00170 addAttribute (dataset, "id", fXMLId); 00171 newValue (newElement (dataset, "KIND_OF_CONDITION"), "NAME", fKind); 00172 newValue (dataset, "VERSION", fVersion); 00173 makeRun (dataset, fRun); 00174 makeChId (dataset, fDetId); 00175 return dataset; 00176 }
DOMElement * XMLDocument::makeElementIOV | ( | DOMElement * | fElement, | |
unsigned long long | fIovBegin, | |||
unsigned long long | fIovEnd = 0 | |||
) |
Definition at line 178 of file HcalDbXml.cc.
References addAttribute(), IOV_ID, newElement(), and newValue().
Referenced by dumpObject_().
00178 { 00179 DOMElement* iov = newElement (fElement, "IOV"); 00180 addAttribute (iov, "id", IOV_ID); 00181 newValue (iov, "INTERVAL_OF_VALIDITY_BEGIN", fIovBegin); 00182 if (fIovEnd) { 00183 newValue (iov, "INTERVAL_OF_VALIDITY_END", fIovEnd); 00184 } 00185 return iov; 00186 }
DOMElement * XMLDocument::makeElementTag | ( | DOMElement * | fElement, | |
const std::string & | fTagName, | |||
const std::string & | fDetectorName, | |||
const std::string & | fComment = "Automatically created by HcalDbXml" | |||
) |
Definition at line 188 of file HcalDbXml.cc.
References addAttribute(), newElement(), newValue(), ecalRecalibSequence_cff::tag, and TAG_ID.
Referenced by dumpObject_().
00188 { 00189 DOMElement* tag = newElement (fElement, "TAG"); 00190 addAttribute (tag, "id", TAG_ID); 00191 addAttribute (tag, "mode", "create"); 00192 newValue (tag, "TAG_NAME", fTagName); 00193 newValue (tag, "DETECTOR_NAME", fDetectorName); 00194 newValue (tag, "COMMENT_DESCRIPTION", fComment); 00195 return tag; 00196 }
DOMElement * XMLDocument::makeHeader | ( | DOMElement * | fRoot, | |
const std::string & | fExtensionName, | |||
unsigned long | fRun | |||
) |
Definition at line 127 of file HcalDbXml.cc.
References header, makeRun(), makeType(), and newElement().
Referenced by dumpObject_().
00127 { 00128 DOMElement* header = newElement (fRoot, "HEADER"); 00129 makeType (header, fExtensionName); 00130 makeRun (header, fRun); 00131 return header; 00132 }
DOMElement * XMLDocument::makeMapDataset | ( | DOMElement * | fIov, | |
int | fXMLId | |||
) |
Definition at line 220 of file HcalDbXml.cc.
References addAttribute(), element(), and newElement().
Referenced by dumpObject_().
00220 { 00221 DOMElement* element = newElement (fIov, "DATA_SET"); 00222 addAttribute (element, "idref", fXMLId); 00223 return element; 00224 }
DOMElement * XMLDocument::makeMapIOV | ( | DOMElement * | fTag | ) |
Definition at line 214 of file HcalDbXml.cc.
References addAttribute(), IOV_ID, and newElement().
Referenced by dumpObject_().
00214 { 00215 DOMElement* iov = newElement (fTag, "IOV"); 00216 addAttribute (iov, "idref", IOV_ID); 00217 return iov; 00218 }
DOMElement * XMLDocument::makeMaps | ( | DOMElement * | fRoot | ) |
Definition at line 203 of file HcalDbXml.cc.
References newElement().
Referenced by dumpObject_().
00203 { 00204 DOMElement* map = newElement (fRoot, "MAPS"); 00205 return map; 00206 }
DOMElement * XMLDocument::makeMapTag | ( | DOMElement * | fMap | ) |
Definition at line 208 of file HcalDbXml.cc.
References addAttribute(), newElement(), ecalRecalibSequence_cff::tag, and TAG_ID.
Referenced by dumpObject_().
00208 { 00209 DOMElement* tag = newElement (fMap, "TAG"); 00210 addAttribute (tag, "idref", TAG_ID); 00211 return tag; 00212 }
DOMElement * XMLDocument::makeRun | ( | DOMElement * | fHeader, | |
unsigned long | fRun | |||
) |
Definition at line 141 of file HcalDbXml.cc.
References newElement(), newValue(), and mergeAndRegister_online::run.
Referenced by makeElementDataset(), and makeHeader().
00141 { 00142 DOMElement* run =newElement (fHeader, "RUN"); 00143 newValue (run, "RUN_TYPE", "HcalDbXml"); 00144 newValue (run, "RUN_NUMBER", fRun); 00145 return run; 00146 }
DOMElement * XMLDocument::makeType | ( | DOMElement * | fHeader, | |
const std::string & | fExtensionName | |||
) |
Definition at line 134 of file HcalDbXml.cc.
References extensionTableName(), newElement(), and newValue().
Referenced by makeHeader().
00134 { 00135 DOMElement* type = newElement (fHeader, "TYPE"); 00136 newValue (type, "EXTENSION_TABLE_NAME", extensionTableName (fKind)); 00137 newValue (type, "NAME", fKind); 00138 return type; 00139 }
DOMElement * XMLDocument::newElement | ( | DOMElement * | fParent, | |
const T & | fName | |||
) | [inline] |
Definition at line 108 of file HcalDbXml.cc.
References element(), mDoc, and transcode().
Referenced by makeChId(), makeData(), makeDataset(), makeElement(), makeElementDataset(), makeElementIOV(), makeElementTag(), makeHeader(), makeMapDataset(), makeMapIOV(), makeMaps(), makeMapTag(), makeRun(), makeType(), and newValue().
00108 { 00109 DOMElement* element = mDoc->createElement (transcode (fName)); 00110 fParent->appendChild (element); 00111 return element; 00112 }
DOMElement * XMLDocument::newValue | ( | DOMElement * | fParent, | |
const std::string & | fName, | |||
const T & | fValue | |||
) | [inline] |
Definition at line 114 of file HcalDbXml.cc.
References element(), mDoc, newElement(), and transcode().
Referenced by addData(), makeChId(), makeData(), makeDataset(), makeElementDataset(), makeElementIOV(), makeElementTag(), makeRun(), and makeType().
00114 { 00115 DOMElement* element = newElement (fParent, fName); 00116 DOMText* text = mDoc->createTextNode (transcode (fValue)); 00117 element->appendChild (text); 00118 return element; 00119 }
void XMLDocument::openForRead | ( | const std::string & | fileName | ) | [private] |
Definition at line 95 of file XMLDocument.cc.
References doc, e, lat::endl(), errHandler, Exception, prof2calltree::node, parser, and rootNode.
Referenced by XMLDocument().
00096 { 00097 parser = std::auto_ptr<XercesDOMParser>(new XercesDOMParser()); 00098 parser->setValidationScheme(XercesDOMParser::Val_Auto); 00099 parser->setDoNamespaces(false); 00100 parser->setDoSchema(false); 00101 parser->setValidationSchemaFullChecking(false); 00102 00103 errHandler = std::auto_ptr<HandlerBase>(new HandlerBase()); 00104 parser->setErrorHandler(errHandler.operator -> ()); 00105 parser->setCreateEntityReferenceNodes(false); 00106 00107 try { 00108 parser->parse(fileName.c_str()); 00109 if (parser->getErrorCount()) 00110 throw cms::Exception("XMLDocument") 00111 << "XML parser reported errors." 00112 << std::endl; 00113 } catch(const XMLException &e) { 00114 throw cms::Exception("XMLDocument") 00115 << "XML parser reported DOM error no. " 00116 << (unsigned long)e.getCode() 00117 << ": " << XMLSimpleStr(e.getMessage()) << "." 00118 << std::endl; 00119 } catch(const SAXException &e) { 00120 throw cms::Exception("XMLDocument") 00121 << "XML parser reported: " 00122 << XMLSimpleStr(e.getMessage()) << "." 00123 << std::endl; 00124 } 00125 00126 doc = parser->getDocument(); 00127 00128 DOMNode *node = doc->getFirstChild(); 00129 while(node && node->getNodeType() != DOMNode::ELEMENT_NODE) 00130 node = node->getNextSibling(); 00131 00132 if (!node) 00133 throw cms::Exception("XMLDocument") 00134 << "XML document didn't contain a valid " 00135 << "root node." << std::endl; 00136 00137 rootNode = static_cast<DOMElement*>(node); 00138 }
void XMLDocument::openForWrite | ( | const std::string & | fileName | ) | [private] |
Definition at line 140 of file XMLDocument.cc.
References impl.
Referenced by XMLDocument().
00141 { 00142 impl = DOMImplementationRegistry::getDOMImplementation( 00143 XMLUniStr("LS")); 00144 assert(impl); 00145 }
bool XMLDocument::readAttribute | ( | XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * | elem, | |
const char * | name, | |||
const bool & | defValue | |||
) | [inline] |
Definition at line 207 of file XMLDocument.cc.
References isBool().
00210 { 00211 XMLUniStr uniName(name); 00212 if (!elem->hasAttribute(uniName)) 00213 return defValue; 00214 const XMLCh *attribute = elem->getAttribute(uniName); 00215 return isBool(XMLSimpleStr(attribute)); 00216 }
static T XMLDocument::readAttribute | ( | XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * | elem, | |
const char * | name, | |||
const T & | defValue | |||
) | [inline, static] |
bool XMLDocument::readAttribute | ( | XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * | elem, | |
const char * | name | |||
) | [inline, static] |
Definition at line 192 of file XMLDocument.cc.
References lat::endl(), and isBool().
00195 { 00196 XMLUniStr uniName(name); 00197 if (!elem->hasAttribute(uniName)) 00198 throw cms::Exception("MVAComputer") 00199 << "Missing attribute " << name << " in tag " 00200 << XMLSimpleStr(elem->getNodeName()) 00201 << "." << std::endl; 00202 const XMLCh *attribute = elem->getAttribute(uniName); 00203 return isBool(XMLSimpleStr(attribute)); 00204 }
bool XMLDocument::readContent | ( | XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * | node | ) | [inline, static] |
Definition at line 227 of file XMLDocument.cc.
References isBool().
00229 { 00230 const XMLCh *content = node->getTextContent(); 00231 return isBool(XMLSimpleStr(content)); 00232 }
DOMElement * XMLDocument::root | ( | ) |
Definition at line 125 of file HcalDbXml.cc.
References mDoc.
Referenced by dumpObject_(), and streamOut().
00125 { return mDoc->getDocumentElement();}
void XMLDocument::streamOut | ( | std::ostream & | fOut | ) |
Definition at line 297 of file HcalDbXml.cc.
References mDoc, mDom, and root().
Referenced by dumpObject_().
00297 { 00298 StreamOutFormatTarget formTaget (fOut); 00299 DOMWriter* domWriter = mDom->createDOMWriter(); 00300 domWriter->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true); 00301 domWriter->writeNode (&formTaget, *(root())); 00302 mDoc->release (); 00303 }
void XMLDocument::writeAttribute | ( | XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * | elem, | |
const char * | name, | |||
const bool & | value | |||
) | [inline] |
static void XMLDocument::writeAttribute | ( | XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * | elem, | |
const char * | name, | |||
const T & | value | |||
) | [inline, static] |
Referenced by xmlStorePDF().
void XMLDocument::writeContent | ( | XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * | node, | |
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * | doc, | |||
const bool & | value | |||
) | [inline] |
static void XMLDocument::writeContent | ( | XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * | node, | |
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * | doc, | |||
const T & | value | |||
) | [inline, static] |
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* XMLDocument::doc [private] |
Definition at line 72 of file XMLDocument.h.
Referenced by createDocument(), dumpObject_(), getDocument(), openForRead(), and ~XMLDocument().
std::auto_ptr<XERCES_CPP_NAMESPACE_QUALIFIER HandlerBase> XMLDocument::errHandler [private] |
std::string XMLDocument::fileName [private] |
XERCES_CPP_NAMESPACE_QUALIFIER DOMImplementation* XMLDocument::impl [private] |
Definition at line 70 of file XMLDocument.h.
Referenced by createDocument(), openForWrite(), and ~XMLDocument().
DOMDocument* XMLDocument::mDoc [private] |
Definition at line 94 of file HcalDbXml.cc.
Referenced by document(), newElement(), newValue(), root(), streamOut(), and XMLDocument().
DOMImplementation* XMLDocument::mDom [private] |
std::auto_ptr<XERCES_CPP_NAMESPACE_QUALIFIER XercesDOMParser> XMLDocument::parser [private] |
Definition at line 68 of file XMLDocument.h.
Referenced by lhef::XMLDocument::init(), makeChId(), openForRead(), and lhef::XMLDocument::parse().
std::auto_ptr<XercesPlatform> XMLDocument::platform [private] |
Definition at line 63 of file XMLDocument.h.
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement* XMLDocument::rootNode [private] |
Definition at line 73 of file XMLDocument.h.
Referenced by createDocument(), getRootNode(), and openForRead().
bool XMLDocument::write [private] |