Hi! I am using Xerces 2.2.0 and BCB 5. I have stripped DOMCounter to a minimum, but when I am
running it a receive EndOfEntityException. Is this normal or I am doing
something wrong? Magnus Karlsson
DOMDocument *doc = NULL; //
Initialize the XML4C system
try {
XMLPlatformUtils::Initialize(); }
catch (const XMLException &e) { memo->Lines->Add("Error
during initialization.");
memo->Lines->Add(e.getMessage()); return; } //
Instantiate the DOM parser.
static const XMLCh gLS[] = { chLatin_L, chLatin_S, chNull };
DOMImplementation *impl =
DOMImplementationRegistry::getDOMImplementation(gLS);
DOMBuilder *parser =
((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS,
0);
parser->setFeature(XMLUni::fgDOMNamespaces, false);
parser->setFeature(XMLUni::fgXercesSchema, false);
parser->setFeature(XMLUni::fgXercesSchemaFullChecking, false);
parser->setFeature(XMLUni::fgDOMValidateIfSchema, false); //
enable datatype normalization - default is off
parser->setFeature(XMLUni::fgDOMDatatypeNormalization, true); //
And create our error handler and install it XMLErrorHandler errorHandler; errorHandler.setOutput(memo); parser->setErrorHandler(&errorHandler); String xmlFile =
"file:///C:/temp/Ny mapp (30)/DAOConfiguration.xml";
try {
errorHandler.resetErrors(); // reset document pool
parser->resetDocumentPool(); doc =
parser->parseURI(xmlFile.c_str()); }
catch (const XMLException &e) { memo->Lines->Add("Error
during parsing: " + xmlFile);
memo->Lines->Add(e.getMessage()); }
catch (const DOMException& e) { const unsigned int
maxChars = 2047; XMLCh errText[maxChars + 1]; memo->Lines->Add("DOM
Error during parsing: " + xmlFile);
memo->Lines->Add("DOMException code is: " + e.code); if
(DOMImplementation::loadDOMExceptionMsg(e.code, errText, maxChars))
memo->Lines->Add("Message is: " + (String) errText);; }
catch (Exception &e) {
memo->Lines->Add("Unexpected exception during parsing: "
+ xmlFile); } //
// Extract the DOM tree,
get the list of all the elements and report the
// length as the count of
elements. // if
(errorHandler.getHasErrors()) { }
else { if (doc != NULL) {
memo->Lines->Add("OK"); } else { } } //
// Delete the parser
itself. Must be done prior to
calling Terminate, below. //
parser->release(); //
And call the termination method
XMLPlatformUtils::Terminate(); Magnus Karlsson _________________________________________________ Magnus Karlsson Consultant, M. Sc. Transrail
Sweden AB, Infosys Torget 1, SE - 172 67
Sundbyberg +46 8 404 09 94. +46 70 218 00 84 www.transrail.se |
- Re: EndOfEntityException when calling DOMBuilder::parseURI Magnus Karlsson
- Re: EndOfEntityException when calling DOMBuilder::par... Neil Graham
- SV: EndOfEntityException when calling DOMBuilder:... Magnus Karlsson
- Re: SV: EndOfEntityException when calling DOM... Vitaly Prapirny