You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Mike Brennan <ps...@pittstate.edu> on 2003/10/14 16:07:20 UTC
SAX2 Progressive Parse
Greetings:
First, I apologize if this is the wrong forum for this question.
I couldn't find any that seemed more appropriate.
Platform details: Xerces C++ 2.3.0, AIX 5.1, xlC 5.0.2
I've been trying to learn Xerces C++ by reading the documentation,
looking at the source, and modifying the provided sample programs.
I've been attempting to take a first pass at progressive parsing
via SAX2 by modifying the sample program SAX2Print.cpp to use
parseFirst() and parseNext().
When I run the modified program, it aborts with the message
"IOT/Abort trap(coredump)".
Details:
I began by making a simple modification to the sample program
SAX2Print.cpp as follows. I commented out the two lines
in the try block shown below, and then added the additional
code as shown:
try
{
SAX2PrintHandlers handler(encodingName, unRepFlags, expandNamespaces);
parser->setContentHandler(&handler);
parser->setErrorHandler(&handler);
//parser->parse(xmlFile);
//errorCount = parser->getErrorCount();
}
catch (const XMLException& toCatch) { ... }
// Added:
XMLPScanToken token;
if (!parser->parseFirst(xmlFile, token))
{
cerr << "scanFirst() failed\n" << endl;
XMLPlatformUtils::Terminate();
return 1;
}
...
It appears that the abort occurs in the call
fErrorHandler->resetErrors();
in the function
void SAX2XMLReaderImpl::resetErrors()
in the file
SAX2XMLReaderImpl.cpp
That's as much as I've been able to determine in my debugging
attempts. Any ideas or suggestions? Should the modification to
the sample work as I intended? Thanks.
-Mike
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: SAX2 Progressive Parse
Posted by da...@us.ibm.com.
> try
> {
> SAX2PrintHandlers handler(encodingName, unRepFlags,
expandNamespaces);
> parser->setContentHandler(&handler);
> parser->setErrorHandler(&handler);
> //parser->parse(xmlFile);
> //errorCount = parser->getErrorCount();
> }
>
> catch (const XMLException& toCatch) { ... }
>
> // Added:
>
> XMLPScanToken token;
>
> if (!parser->parseFirst(xmlFile, token))
> {
> cerr << "scanFirst() failed\n" << endl;
> XMLPlatformUtils::Terminate();
> return 1;
> }
>
> ...
>
>
>It appears that the abort occurs in the call
>
> fErrorHandler->resetErrors();
>
>in the function
>
> void SAX2XMLReaderImpl::resetErrors()
>
>in the file
>
> SAX2XMLReaderImpl.cpp
The instance of SAX2PrintHandlers you are using is local to the try/catch
block and is destroyed before you start parsing. Moving it before the
block, or moving your parsing code within the block, will solve the
problem.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org