[Expat-discuss] XML_Parser reset function

Damien Dykman dykman@exentis.com
Tue, 17 Oct 2000 14:53:15 +0200


Hi,
I was wondering if it would be possible to have sort of a
XML_ParserReset(..) function to reset a XML_Parser object without freeing
and reallocating memory.

Actually I would like to be able to call the XML_Parse(..) function many
times with the same XML_Parser object without calling XML_Free(..) and
XML_Create(..) again and again. The aim of this function would be to avoid
memory fragmentation when calling XML_Parse(..) thousands of times in the
same process.

To make things clearer, here is sample of how I use Expat library:

 XML_Parser parser;
 for (;;) {
   ...
   parser = XML_ParserCreate(..);
   XML_SetElementHandler(parser, ...);
   XML_Parse(parser, ...);
   XML_ParserFree(parser);
   ...
 }

This is the way I would like to be able to use it:

 XML_Parser parser = XML_ParserCreate(..);
 XML_SetElementHandler(parser, ...);
 for (;;) {
   ...
   XML_Parse(parser, ...);
   XML_ParserReset(parser);
   ...
 }
 XML_ParserFree(parser);

-----
Thanks for your help,
Damien.