You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Shirish M. Kulkarni" <sh...@ptc.com> on 2001/12/23 11:30:31 UTC

Single instance of Xerces parser for multiple parse() calls in an application

Hi,

I have the following observation

   * A single instance of parser, is successfully able to serve, mutiple
     calls to parse() method - with an additional call to reset(),
     before the re-use

Please let me have the views for the experienced / expert user
community, if my observation is a well known fact. Or let me know, that
even-if this is working sucessfully, this is not a recommended approach
( it is not supposed to be working this-way ? ) => as per apache.org

Thanks.

--
With best regards,

Shirish



Re: Single instance of Xerces parser for multiple parse() calls in an application

Posted by Tinny Ng <tn...@ca.ibm.com>.
With single instance of parser, you can can parse() multiple times.  The
parser in fact will call 'reset()' internally everytime, so you don't really
need to call 'reset()' before re-use.

Tinny

"Shirish M. Kulkarni" wrote:

> Jas :
>
> Thanks for your inputs.
>
> > In my experience this is true only as long as you parse documents that
> > do not generate parse errors. Once you hit an error, reset() no longer
> > works properly and you have to create a new parser intstance.
> >
> > I hope this has changed, but when I was attempting this for the
> > conformance testing suite I was forced into creating a new parser
> > instance for each file, which seemed an aweful waste of resources.
>
> This indeed seems to have changed in Xerces v1.5.1. I was able to
> successfully use same instance of parser, even after generating
> exceptions.
>
> I would invite comments from someone from Xerces development ( apache.org
> or ibm.com ) to autheticate our findings.
>
> --
> With best regards,
>
> Shirish
>
>   ------------------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


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


Re: Single instance of Xerces parser for multiple parse() calls in an application

Posted by "Shirish M. Kulkarni" <sh...@ptc.com>.
Jas :

Thanks for your inputs.

> In my experience this is true only as long as you parse documents that
> do not generate parse errors. Once you hit an error, reset() no longer
> works properly and you have to create a new parser intstance.
>
> I hope this has changed, but when I was attempting this for the
> conformance testing suite I was forced into creating a new parser
> instance for each file, which seemed an aweful waste of resources.

This indeed seems to have changed in Xerces v1.5.1. I was able to
successfully use same instance of parser, even after generating
exceptions.

I would invite comments from someone from Xerces development ( apache.org
or ibm.com ) to autheticate our findings.

--
With best regards,

Shirish


Re: Single instance of Xerces parser for multiple parse() calls in an application

Posted by "Jason E. Stewart" <ja...@openinformatics.com>.
"Shirish M. Kulkarni" <sh...@ptc.com> writes:

>    * A single instance of parser, is successfully able to serve,
>      mutiple calls to parse() method - with an additional call to
>      reset(), before the re-use

In my experience this is true only as long as you parse documents that
do not generate parse errors. Once you hit an error, reset() no longer
works properly and you have to create a new parser intstance.

I hope this has changed, but when I was attempting this for the
conformance testing suite I was forced into creating a new parser
instance for each file, which seemed an aweful waste of resources.

jas.

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