14 #include <xercesc/dom/DOM.hpp>
15 #include <xercesc/dom/DOMNode.hpp>
16 #include <xercesc/parsers/XercesDOMParser.hpp>
17 #include <xercesc/util/PlatformUtils.hpp>
18 #include <xercesc/framework/LocalFileFormatTarget.hpp>
23 using namespace xercesc;
36 stringstream ieta_str ;
37 stringstream iphi_str;
40 stringstream ixSC_str;
41 stringstream iySC_str ;
42 stringstream zside_str ;
61 if (ieta && iphi) {
return EBDetId(ieta,iphi);}
62 if (ix && iy && zside){
return EEDetId(ix,iy,zside);}
63 if (ixSC && iySC && zside){
return EcalScDetId(ixSC, iySC, zside);}
65 cerr<<
"XMLCell: error reading cell, missing field ?"<<std::endl;
75 DOMElement* cell_node =
78 node->appendChild(cell_node);
96 unsigned int ScIdCheck = detid.
rawId() & 0x00008000;
115 stringstream value_s;
133 stringstream value_s;
152 for (DOMNode* childNode = node->getFirstChild();
153 childNode; childNode = childNode->getNextSibling()) {
155 if (childNode->getNodeType() == DOMNode::ELEMENT_NODE) {
157 const string foundName =
toNative(childNode->getNodeName());
159 if (foundName == nodename)
return childNode;
174 DOMElement* headernode =
176 parentNode->appendChild(headernode);
217 XMLPlatformUtils::Initialize();
219 XercesDOMParser*
parser =
new XercesDOMParser;
220 parser->setValidationScheme( XercesDOMParser::Val_Never );
221 parser->setDoNamespaces(
false );
222 parser->setDoSchema(
false );
224 parser->parse(filename.c_str());
226 DOMDocument* xmlDoc = parser->getDocument();
230 std::cout <<
"Error parsing document" << std::endl;
234 DOMElement* elementRoot = xmlDoc->getDocumentElement();
239 XMLPlatformUtils::Terminate();
245 value=
toNative(node->getTextContent());
void GetNodeStringData(xercesc::DOMNode *node, std::string &value)
get the node data as string. Needs to be used to avoid splitting
const std::string iySC_tag("iySC")
const std::string Header_sincetag("since")
const std::string iEta_tag("iEta")
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
int ieta() const
get the tower ieta
int iphi() const
get the crystal iphi
uint32_t rawId() const
get the raw id
void readHeader(xercesc::DOMNode *parentNode, EcalCondHeader &header)
read header from
const std::string Header_methodtag("method")
const std::string Cell_tag("cell")
const std::string ix_tag("ix")
const std::string Header_datetag("date")
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
int ieta() const
get the crystal ieta
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
const std::string iy_tag("iy")
const std::string Header_tagtag("tag")
const std::string Header_versiontag("version")
int iphi() const
get the tower iphi
const std::string Header_tag("EcalCondHeader")
void GetNodeData(xercesc::DOMNode *node, T &value)
get the node data
xercesc::DOMNode * getChildNode(xercesc::DOMNode *node, const std::string &nodename)
get the child of
const std::string zside_tag("zside")
const std::string Header_datasourcetag("datasource")
XercesString fromNative(const char *str)
const std::string ixSC_tag("ixSC")
xercesc::DOMElement * writeCell(xercesc::DOMNode *node, const DetId &detid)
Append a Cell node with attributes to.
const std::string iPhi_tag("iPhi")
const DetId readCellId(xercesc::DOMElement *node)
Assuming.
std::string toNative(const XMLCh *str)