We are doing exactly this with great success! There are some additional caveats if you are re-using a grammar (passing true for the second parameter to parse()). Though we use schema exclusively.
1. Grammar will be defined by the first parse. 1. Any errors encountered when parsing the original schema (the first since its the only time it will be parse) will result in a truncated grammar definition that may result in validating invalid documents. Jim > -----Original Message----- > From: Tinny Ng [mailto:[EMAIL PROTECTED]] > Sent: Monday, December 24, 2001 9:52 AM > To: [EMAIL PROTECTED] > Subject: Re: Single instance of Xerces parser for multiple > parse() calls > in an application > > > 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: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]