6 #include <xercesc/util/PlatformUtils.hpp>
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
39 XMLPlatformUtils::Initialize();
40 }
catch(
const XMLException &
e) {
42 <<
"XMLPlatformUtils::Initialize failed "
52 XMLPlatformUtils::Terminate();
58 parser(XMLReaderFactory::createXMLReader()),
67 parser(XMLReaderFactory::createXMLReader()),
76 parser->setFeature(XMLUni::fgSAX2CoreValidation,
false);
77 parser->setFeature(XMLUni::fgSAX2CoreNameSpaces,
false);
78 parser->setFeature(XMLUni::fgXercesSchema,
false);
79 parser->setFeature(XMLUni::fgXercesSchemaFullChecking,
false);
81 parser->setContentHandler(&handler);
82 parser->setLexicalHandler(&handler);
83 parser->setErrorHandler(&handler);
87 <<
"SAXParser::parseFirst failed" << std::endl;
88 }
catch(
const XMLException &
e) {
90 <<
"XMLPlatformUtils::Initialize failed because of "
92 }
catch(
const SAXException &e) {
94 <<
"XML parser reported: "
110 }
catch(
const XMLException &
e) {
112 <<
"XMLPlatformUtils::Initialize failed because of "
114 }
catch(
const SAXException &e) {
116 <<
"XML parser reported: "
137 const unsigned int size)
139 char *rawBuf =
reinterpret_cast<char*
>(buf);
140 unsigned int bytes = size *
sizeof(XMLByte);
141 unsigned int read = 0;
143 while(read < bytes) {
150 unsigned int len =
buffer.length();
151 unsigned int rem = bytes -
read;
153 std::memcpy(rawBuf + read,
buffer.c_str(), rem);
159 std::memcpy(rawBuf + read,
buffer.c_str(), len);
164 read /=
sizeof(XMLByte);
175 <<
"I/O stream bad in STLInputStream::STLInputStream()"
184 const unsigned int size)
186 char *rawBuf =
reinterpret_cast<char*
>(buf);
187 unsigned int bytes = size *
sizeof(XMLByte);
188 in.read(rawBuf, bytes);
193 <<
"I/O stream bad in STLInputStream::readBytes()"
196 unsigned int read = (
unsigned int)(readBytes /
sizeof(XMLByte));
197 unsigned int rest = (
unsigned int)(readBytes %
sizeof(XMLByte));
198 for(
unsigned int i = 1;
i <= rest;
i++)
199 in.putback(rawBuf[readBytes -
i]);
215 const unsigned int size)
217 void *rawBuf =
reinterpret_cast<void*
>(buf);
218 unsigned int bytes = size *
sizeof(XMLByte);
221 unsigned int read = (
unsigned int)(readBytes /
sizeof(XMLByte));
222 unsigned int rest = (
unsigned int)(readBytes %
sizeof(XMLByte));
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)
tuple size
Write out results.