[xsd-users] Reentrant parser?

Boris Kolpackov boris at codesynthesis.com
Fri Mar 30 13:30:47 EDT 2007


Hi Mark,

mhoffm1060 at aol.com <mhoffm1060 at aol.com> writes:

> I was wondering if the xml parsing method ( for istreams ) is reentrant?

Yes, it is.


> ( Or does each call to the method use the same instance of the Xerces
> parser? )

No, each call creates a new parser.


> Basically I have an object that can potentially try to parse two XML
> files in different thread contexts, and it is crashing in the Xerces DLL ).

You will need to call xercesc::XMLPlatformUtils::Initialize() and
xercesc::XMLPlatformUtils::Terminate() in your main() as well as
pass the xml_schema::flags::dont_initialize to the parsing function.

Xerces-C++ Initialize() and Terminate() are not safe to call from
separate threads and that's exactly what may happen when you call
one of the parsing functions from two different threads.


hth,
-boris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 652 bytes
Desc: Digital signature
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070330/5e38a32c/attachment.pgp


More information about the xsd-users mailing list