7 #include <xercesc/util/XMLString.hpp>
8 #include <xercesc/util/XMLUni.hpp>
9 #include <xercesc/sax2/SAX2XMLReader.hpp>
10 #include <xercesc/sax2/XMLReaderFactory.hpp>
19 XERCES_CPP_NAMESPACE_USE
41 }
catch(
const XMLException &
e) {
43 <<
"cms::concurrency::xercesInitialize failed "
59 parser(XMLReaderFactory::createXMLReader()),
68 parser(XMLReaderFactory::createXMLReader()),
77 parser->setFeature(XMLUni::fgSAX2CoreValidation,
false);
78 parser->setFeature(XMLUni::fgSAX2CoreNameSpaces,
false);
79 parser->setFeature(XMLUni::fgXercesSchema,
false);
80 parser->setFeature(XMLUni::fgXercesSchemaFullChecking,
false);
82 parser->setContentHandler(&handler);
83 parser->setLexicalHandler(&handler);
84 parser->setErrorHandler(&handler);
88 <<
"SAXParser::parseFirst failed" << std::endl;
89 }
catch(
const XMLException &
e) {
91 <<
"cms::concurrency::xercesInitialize failed because of "
93 }
catch(
const SAXException &e) {
95 <<
"XML parser reported: "
111 }
catch(
const XMLException &
e) {
113 <<
"cms::concurrency::xercesInitialize failed because of "
115 }
catch(
const SAXException &e) {
117 <<
"XML parser reported: "
138 const unsigned int size)
140 char *rawBuf =
reinterpret_cast<char*
>(buf);
141 unsigned int bytes = size *
sizeof(XMLByte);
142 unsigned int read = 0;
144 while(read < bytes) {
151 unsigned int len =
buffer.length();
152 unsigned int rem = bytes -
read;
154 std::memcpy(rawBuf + read,
buffer.c_str(), rem);
160 std::memcpy(rawBuf + read,
buffer.c_str(), len);
165 read /=
sizeof(XMLByte);
176 <<
"I/O stream bad in STLInputStream::STLInputStream()"
185 const unsigned int size)
187 char *rawBuf =
reinterpret_cast<char*
>(buf);
188 unsigned int bytes = size *
sizeof(XMLByte);
189 in.read(rawBuf, bytes);
194 <<
"I/O stream bad in STLInputStream::readBytes()"
197 unsigned int read = (
unsigned int)(readBytes /
sizeof(XMLByte));
198 unsigned int rest = (
unsigned int)(readBytes %
sizeof(XMLByte));
199 for(
unsigned int i = 1;
i <= rest;
i++)
200 in.putback(rawBuf[readBytes -
i]);
208 lstr(LZMA_STREAM_INIT),
223 lstr = LZMA_STREAM_INIT;
227 #if LZMA_VERSION <= UINT32_C(49990030)
230 int ret = lzma_auto_decoder(&
lstr, -1, 0);
236 throw cms::Exception(
"IO") <<
"Error while reading compressed LHE file";
247 const unsigned int size)
252 void *rawBuf =
reinterpret_cast<void*
>(buf);
253 unsigned int bytes = size *
sizeof(XMLByte);
256 unsigned int read = (
unsigned int)(readBytes /
sizeof(XMLByte));
257 unsigned int rest = (
unsigned int)(readBytes %
sizeof(XMLByte));
278 unsigned int bytes = size *
sizeof(XMLByte);
282 lstr.next_in = inBuf;
285 lstr.avail_out = bytes;
291 int ret = lzma_code(&
lstr, LZMA_RUN);
292 if(ret != LZMA_OK && ret != LZMA_STREAM_END) {
294 throw cms::Exception(
"IO") <<
"Error while reading compressed LHE file";
std::auto_ptr< Storage > storage
std::auto_ptr< XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader > parser
void init(Handler &handler)
virtual IOSize read(void *into, IOSize n, IOOffset pos)
std::auto_ptr< XERCES_CPP_NAMESPACE_QUALIFIER InputSource > source
std::auto_ptr< XercesPlatform > platform
XMLDocument(std::auto_ptr< std::istream > &in, Handler &handler)
XERCES_CPP_NAMESPACE_QUALIFIER XMLPScanToken token
virtual IOOffset position(void) const
StorageWrap(Storage *storage)
volatile std::atomic< bool > shutdown_flag false
static std::string const source
tuple size
Write out results.