[Expat-discuss] Re: How to stop parsing...
Carlos Pereira
carlos at pehoe.civil.ist.utl.pt
Thu Oct 30 06:03:50 EST 2003
>Karam Chand writes:
> > I have a big XML file to parse. I want to stop parsing
> > after I have reached a certain element. How can I do
> > it?
> >
> > I am using C++. startElementHandler nor
> > endElementHandler has any return values that can tell
> > the parser to stop parsing element?
>
>Expat 3.0 will require that callbacks return an XML_Status value to
>inform the parser how to proceed.
>
>With the current Expat and C++, you can raise a C++ exception to exit
>parsing.
In the present, you can do (at the end of the element callback):
if (ml->my_flag == FALSE)
XML_SetElementHandler (ml->parser, NULL, NULL);
in the future, you can do (at the end of the element callback):
return ml->my_flag;
Not terribly different ;-)
Carlos
More information about the Expat-discuss
mailing list