[Expat-discuss] Stopping the parser

Sylvain PRAT syprat@yahoo.fr
Tue, 21 Aug 2001 15:47:49 +0200 (CEST)


Hi,

I'm experiencing a new problem using expat : 
I have to do an incremental parsing of a file , i have
a file describing a set of events and i need to read
it event by event (with first, next functions), so on
the event end tag, i would like to stop the parser.
But i see no convenient way to do that. 

I first used a boolean in my loop (reading from the
file, parsing the resulting buffer) to stop it (which
is set in the event end element handler), but the
parser still parsed the rest of the buffer, and i lost
the next data. We can't go back parsing (i think), the
only way is to create a new parser to parse the next
event (starting after the event end tag file
position), but obviously, the parser will state an
error because at the last event, it will encounter the
end tag of the set of events (dealing with errors,
possible but very bad solution i think)... I have also
thought of using a stack/set/list to remember the
events, but it's not easy to make it (it's c++, i
couldn't use the stl, and moreover the events are
quite complicated to be pushed)
So is there's a solution to this, is it difficult to
add a stop parser feature, something else ???

Thanks



___________________________________________________________
Do You Yahoo!? -- Vos albums photos en ligne, 
Yahoo! Photos : http://fr.photos.yahoo.com