[Expat-discuss] How to stop parsing after reaching a certain element

Fred L. Drake, Jr. fdrake at acm.org
Thu Oct 30 01:38:35 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.


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation



More information about the Expat-discuss mailing list