Search code examples
c++xerces-c

When calling XMLPlatformUtils::Initialize() on Xerces?


I'm using Xerces and references are not very clear about when using Initialize and Terminate.

Well, many web sites typically tells you: "Always put your Xerces code between these two lines".

But do I always have to do that? Or just when parsing?

Thank you


Solution

  • You have to call this Initialize once per process, before you use any Xerces-C++ functionality. You have to call Terminate once per process, when you're finished using Xerces.

    The obvious place to put these is either main, in a singleton object, or in some RAII object that is in scope while Xerces is used.