You are viewing a plain text version of this content. The canonical link for it is here.
Posted to p-dev@xerces.apache.org by ted sandler <te...@rcn.com> on 2002/05/09 06:35:44 UTC
How to reset a parser after errors encountered?
Xerces has been working great for me except for this one problem:
I am parsing a bunch of documents, and everything works okay until I hit a
bad one. At this point, my program puts the bad document aside and attempts
to move onto the next document. However, the parser keeps choking with the
following error:
Error in `../data/a_and_c.xml':
Parse may not be called while parsing
How does one reset the parser & its handlers so that the program can
continue processing documents? I've tried calling &resetErrors but this
doesn't work.
Thanks in advance,
-ted sandler
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org
Re: How to reset a parser after errors encountered?
Posted by "Jason E. Stewart" <ja...@openinformatics.com>.
"ted sandler" <te...@rcn.com> writes:
> Likewise, should one create a new parser for each and every
> document? One could imagine the parser's internal state getting
> severly confused by "good" documents as well.
I do. But I don't have all that many programs that burn through large
amounts of documents. Usually I'm parsing small numbers of very large
documents.
The way I set it up to deal with large numbers of documents was to
trap the errors, and only create a new parser on an error, because
apparently the internal state is fine unless there's an exception.
jas.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org
Re: How to reset a parser after errors encountered?
Posted by ted sandler <te...@rcn.com>.
Likewise, should one create a new parser for each and every document? One
could imagine the parser's internal state getting severly confused by "good"
documents as well.
-ted
----- Original Message -----
From: "Jason E. Stewart" <ja...@openinformatics.com>
To: <xe...@xml.apache.org>
Sent: Thursday, May 09, 2002 1:28 AM
Subject: Re: How to reset a parser after errors encountered?
> "ted sandler" <te...@rcn.com> writes:
>
> > Xerces has been working great for me except for this one problem:
> >
> > I am parsing a bunch of documents, and everything works okay until I hit
a
> > bad one. At this point, my program puts the bad document aside and
attempts
> > to move onto the next document. However, the parser keeps choking with
the
> > following error:
> >
> > Error in `../data/a_and_c.xml':
> > Parse may not be called while parsing
> >
> > How does one reset the parser & its handlers so that the program can
> > continue processing documents? I've tried calling &resetErrors but this
> > doesn't work.
>
> I never figured out a very satisfying way to do this. Basically the
> problem is that the parsers internal state gets severely confused, and
> cannot be reset.
>
> The only way I figured out was simply to create a new parser and use
> it instead. Like I said, not very satisfying, but it was the only
> method I could find.
>
> jas.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-p-dev-help@xml.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org
Re: How to reset a parser after errors encountered?
Posted by "Jason E. Stewart" <ja...@openinformatics.com>.
"ted sandler" <te...@rcn.com> writes:
> Xerces has been working great for me except for this one problem:
>
> I am parsing a bunch of documents, and everything works okay until I hit a
> bad one. At this point, my program puts the bad document aside and attempts
> to move onto the next document. However, the parser keeps choking with the
> following error:
>
> Error in `../data/a_and_c.xml':
> Parse may not be called while parsing
>
> How does one reset the parser & its handlers so that the program can
> continue processing documents? I've tried calling &resetErrors but this
> doesn't work.
I never figured out a very satisfying way to do this. Basically the
problem is that the parsers internal state gets severely confused, and
cannot be reset.
The only way I figured out was simply to create a new parser and use
it instead. Like I said, not very satisfying, but it was the only
method I could find.
jas.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org