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 SonalG <gs...@gmail.com> on 2012/08/09 08:37:57 UTC

Multithreaded SAX parser

Hi,

I want to parser multiple XML documents using SAX parser.
I read somewhere on the net that you can create a pool of threads for this
purpose but did not find sample code supporting it.

One way is create a different parser object each time, but this is expensive
operation and also calling initialize for each new parser object is
expensive

Does any one have any examples to share?

My application is creating different thread which internally calls the
"parse" method of the same "parser object". This gives strange results as it
is reading one file correctly but for the second XML file it just reads part
of file and stops.
-- 
View this message in context: http://old.nabble.com/Multithreaded-SAX-parser-tp34275125p34275125.html
Sent from the Xerces - C - Dev mailing list archive at Nabble.com.


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


Re: Multithreaded SAX parser

Posted by sh...@e-z.net.
SonalG,

The Xalan-C Transformer uses Xerces-C++ parser.  Did you forget
to reset the parser object before starting your next parse?

Steven J. Hathaway
Xalan Documentation Project

> Hi,
>
> You can look at the ThreadTest project sources in the Xerces-C++
> distribution.
>
> Good luck!
> 	Vitaly
>
> SonalG wrote:
>>
>> Hi,
>>
>> I want to parser multiple XML documents using SAX parser.
>> I read somewhere on the net that you can create a pool of threads for
>> this
>> purpose but did not find sample code supporting it.
>>
>> One way is create a different parser object each time, but this is
>> expensive
>> operation and also calling initialize for each new parser object is
>> expensive
>>
>> Does any one have any examples to share?
>>
>> My application is creating different thread which internally calls the
>> "parse" method of the same "parser object". This gives strange results
>> as it
>> is reading one file correctly but for the second XML file it just reads
>> part
>> of file and stops.
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> For additional commands, e-mail: c-dev-help@xerces.apache.org
>
>



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


Re: Multithreaded SAX parser

Posted by Vitaly Prapirny <ma...@mebius.net>.
Hi,

You can look at the ThreadTest project sources in the Xerces-C++ 
distribution.

Good luck!
	Vitaly

SonalG wrote:
>
> Hi,
>
> I want to parser multiple XML documents using SAX parser.
> I read somewhere on the net that you can create a pool of threads for this
> purpose but did not find sample code supporting it.
>
> One way is create a different parser object each time, but this is expensive
> operation and also calling initialize for each new parser object is
> expensive
>
> Does any one have any examples to share?
>
> My application is creating different thread which internally calls the
> "parse" method of the same "parser object". This gives strange results as it
> is reading one file correctly but for the second XML file it just reads part
> of file and stops.
>


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