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 Nicholas Jones <Ni...@RCP.co.uk> on 2000/07/27 12:29:00 UTC

Missing start/end Document events in SAX Parser?

Hello, 
I am using the SAX Parser and want to allow a consumer to abort the parsing,
I then decided to use the parseFirst(), parseNext(), parseReset() methods to
iterate through the document.
On changing to this method I noticed that the startDocument and endDocument
events no longer fired.
Is this a bug in the SAX parser or is my workaround an accepted solution?
(Obviously I don't want to start getting multiple startDocument /
endDocument events with later versions of the parser).

Apologies if this issue has already been addressed in the past or I am
missing the point in some way.

Here is a segment of the code I am using (including workaround).

m_pParser->startDocument(); 	//Workaround is to add this line
bool bParseState = m_pParser->parseFirst(*memBufIS,toFill);
while ( bParseState)
{
	if (m_bStopParse)
	{
		m_pParser->parseReset(toFill);
		bParseState = false;
	}
	else
	{
		bParseState = m_pParser->parseNext(toFill);
	}
}
m_pParser->endDocument();	//Workaround is to add this line

Many thanks


Nick

Re: Missing start/end Document events in SAX Parser?

Posted by Joe Polastre <jp...@apache.org>.
You'll notice that this has been fixed in CVS.  If you download a nightly
build, the start and end document events will be fired.

This was pointed out by some kind souls on the list.

-Joe Polastre  (jpolast@apache.org)
IBM Cupertino, XML Technology Group


----- Original Message -----
From: "Nicholas Jones" <Ni...@RCP.co.uk>
To: <xe...@xml.apache.org>
Sent: Thursday, July 27, 2000 3:29 AM
Subject: Missing start/end Document events in SAX Parser?


> Hello,
> I am using the SAX Parser and want to allow a consumer to abort the
parsing,
> I then decided to use the parseFirst(), parseNext(), parseReset() methods
to
> iterate through the document.
> On changing to this method I noticed that the startDocument and
endDocument
> events no longer fired.
> Is this a bug in the SAX parser or is my workaround an accepted solution?
> (Obviously I don't want to start getting multiple startDocument /
> endDocument events with later versions of the parser).
>
> Apologies if this issue has already been addressed in the past or I am
> missing the point in some way.
>
> Here is a segment of the code I am using (including workaround).
>
> m_pParser->startDocument(); file://Workaround is to add this line
> bool bParseState = m_pParser->parseFirst(*memBufIS,toFill);
> while ( bParseState)
> {
> if (m_bStopParse)
> {
> m_pParser->parseReset(toFill);
> bParseState = false;
> }
> else
> {
> bParseState = m_pParser->parseNext(toFill);
> }
> }
> m_pParser->endDocument(); file://Workaround is to add this line
>
> Many thanks
>
>
> Nick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>