1 #include "xercesc/sax2/SAX2XMLReader.hpp"
2 #include <xercesc/sax2/XMLReaderFactory.hpp>
3 #include "xercesc/sax2/DefaultHandler.hpp"
4 #include "xercesc/sax2/Attributes.hpp"
6 #include <xercesc/framework/MemBufInputSource.hpp>
7 XERCES_CPP_NAMESPACE_USE
51 xc_Data=XMLString::transcode(
"Data");
52 xc_name=XMLString::transcode(
"name");
53 xc_type=XMLString::transcode(
"type");
67 virtual void startElement (
const XMLCh *
const uri,
const XMLCh *
const localname,
const XMLCh *
const qname,
const Attributes &attrs);
68 virtual void endElement (
const XMLCh *
const uri,
const XMLCh *
const localname,
const XMLCh *
const qname);
69 virtual void characters(
const XMLCh*
const chars,
const unsigned int length);
72 inline bool cvt2String(
const XMLCh* val, std::string& ou) {
73 if (val==0)
return false;
74 char* tool=XMLString::transcode(val);
91 if (!XMLString::compareIString(localname,
xc_Parameter)) {
99 }
else if (!XMLString::compareIString(localname,
xc_Data)) {
101 std::string strElements;
123 if (entry.empty())
continue;
139 while (offset<length) {
141 for (i=0; i<length-offset && i<255; i++)
m_workx[i]=chars[i+offset];
156 m_parser->
parser=std::auto_ptr<xercesc::SAX2XMLReader>(xercesc::XMLReaderFactory::createXMLReader());
159 MemBufInputSource
src((
const unsigned char*)xmlDocument.c_str(), xmlDocument.length(),
"hcal::PatternReader");
168 std::vector<std::string> items;
169 std::string encoding;
171 this->
parse(xmlDocument,parameters,items,encoding);
173 if (encoding==
"dec") formatting=10;
174 if (encoding==
"hex") formatting=16;
177 for (std::vector<std::string>::const_iterator
i=items.begin();
i!=items.end();
i++)
178 data.push_back(strtol(
i->c_str(),0,formatting));
void parse(const std::string &xmlDocument, std::map< std::string, std::string > ¶meters, std::vector< std::string > &items, std::string &encoding)
bool cvt2String(const XMLCh *val, std::string &ou)
std::vector< std::string > & m_items
std::auto_ptr< SAX2XMLReader > parser
std::string & m_dataEncoding
ConfigurationDBHandler(std::map< std::string, std::string > ¶meters, std::vector< std::string > &items, std::string &encoding)
virtual void ignorableWhitespace(const XMLCh *chars, const unsigned int length)
virtual void endElement(const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname)
std::pair< std::string, MonitorElement * > entry
std::map< std::string, std::string > & m_parameters
unsigned int offset(bool)
std::list< ConfigurationDatabaseStandardXMLParser::Item > & m_items
virtual ~ConfigurationDBHandler()
virtual void characters(const XMLCh *const chars, const unsigned int length)
virtual void startElement(const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &attrs)
char data[epos_bytes_allocation]
HcalPatternXMLParserImpl * m_parser
enum ConfigurationDBHandler::@63 m_mode