You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Smith, Doug" <Do...@fmr.com> on 2001/11/08 22:24:54 UTC

Reusing parser instances

Hi,

My apologies if this has been discussed before - I was not able to find
anything in the mail list archives.

I've been pooling and reusing Xerces-J 1.x parser instances, using the
reset() method on SAXParser. Everything works fine until a content handler
generates an exception which terminates the parsing unexpectedly. After
that, the next time the parser instance is used, an exception saying "FWK005
parse may not be called while parsing" is generated when parse is called
(with reset called prior to parse).

I added a line to XMLParser.reset method to work around the problem:

fParseInProgress = false;

This has fixed my problem. Given the fix was so simple, I'm wondering if
there are other issues I'm not aware of that complicate the reuse of
SAXParser instances.

Thanks.

--Doug



Re: Reusing parser instances

Posted by Andy Clark <an...@apache.org>.
"Smith, Doug" wrote:
> I've been pooling and reusing Xerces-J 1.x parser instances, using the
> reset() method on SAXParser. Everything works fine until a content

You should not call reset() directly. It is called automatically
when you parse the next document. Please change your code and
let me know if you still get the parse-in-progress error in the
case where a parser terminates with an exception.

-- 
Andy Clark * IBM, TRL - Japan * andyc@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org