8 #include <xercesc/util/XMLString.hpp>
9 #include <xercesc/util/XMLUni.hpp>
10 #include <xercesc/sax2/SAX2XMLReader.hpp>
11 #include <xercesc/sax2/XMLReaderFactory.hpp>
21 XERCES_CPP_NAMESPACE_USE
42 }
catch(
const XMLException &
e) {
44 <<
"cms::concurrency::xercesInitialize failed "
60 parser(XMLReaderFactory::createXMLReader()),
69 parser(XMLReaderFactory::createXMLReader()),
78 parser->setFeature(XMLUni::fgSAX2CoreValidation,
false);
79 parser->setFeature(XMLUni::fgSAX2CoreNameSpaces,
false);
80 parser->setFeature(XMLUni::fgXercesSchema,
false);
81 parser->setFeature(XMLUni::fgXercesSchemaFullChecking,
false);
83 parser->setContentHandler(&handler);
84 parser->setLexicalHandler(&handler);
85 parser->setErrorHandler(&handler);
89 <<
"SAXParser::parseFirst failed" << std::endl;
90 }
catch(
const XMLException &
e) {
92 <<
"cms::concurrency::xercesInitialize failed because of "
94 }
catch(
const SAXException &e) {
96 <<
"XML parser reported: "
112 }
catch(
const XMLException &
e) {
114 <<
"cms::concurrency::xercesInitialize failed because of "
116 }
catch(
const SAXException &e) {
118 <<
"XML parser reported: "
139 const unsigned int size)
141 char *rawBuf =
reinterpret_cast<char*
>(buf);
142 unsigned int bytes = size *
sizeof(XMLByte);
143 unsigned int read = 0;
145 while(read < bytes) {
152 unsigned int len =
buffer.length();
153 unsigned int rem = bytes -
read;
155 std::memcpy(rawBuf + read,
buffer.c_str(), rem);
161 std::memcpy(rawBuf + read,
buffer.c_str(), len);
166 read /=
sizeof(XMLByte);
177 <<
"I/O stream bad in STLInputStream::STLInputStream()"
186 const unsigned int size)
188 char *rawBuf =
reinterpret_cast<char*
>(buf);
189 unsigned int bytes = size *
sizeof(XMLByte);
190 in.read(rawBuf, bytes);
195 <<
"I/O stream bad in STLInputStream::readBytes()"
198 unsigned int read = (
unsigned int)(readBytes /
sizeof(XMLByte));
199 unsigned int rest = (
unsigned int)(readBytes %
sizeof(XMLByte));
200 for(
unsigned int i = 1;
i <= rest;
i++)
201 in.putback(rawBuf[readBytes -
i]);
209 lstr(LZMA_STREAM_INIT),
225 lstr = LZMA_STREAM_INIT;
229 #if LZMA_VERSION <= UINT32_C(49990030)
232 int ret = lzma_auto_decoder(&
lstr, -1, 0);
238 throw cms::Exception(
"IO") <<
"Error while reading compressed LHE file";
252 assert(
sizeof(XMLByte) ==
sizeof(
unsigned char));
261 ex <<
"Error while reading buffered LHE file";
271 unsigned int dataRead;
276 buffLoc_ += dataRead;
282 lstr.avail_in = dataRead;
285 int ret = lzma_code(&
lstr, LZMA_RUN);
286 if(ret != LZMA_OK && ret != LZMA_STREAM_END)
289 throw cms::Exception(
"IO") <<
"Error while reading compressed LHE file (error code " << ret <<
")";
291 dataRead -=
lstr.avail_in;
292 buffLoc_ += dataRead;
303 dataRead = (size -
lstr.avail_out);
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.