Hi,

I want to parse several files with the same DOMBuilder and release the obtained documents when they are no more needed.
So I call the release method on the document object.
But I get a memory access violation when trying to release the DOMBuilder object.

So it seems to me that users have to create a separate DOMBuilder object for every document in the application.
Is that correct?

Here is a short version of my code:

////////////////// Code Starts Here \\\\\\\\\\\\\\\\\\
#include <xercesc/dom/DOM.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/util/XMLUniDefs.hpp>

XERCES_CPP_NAMESPACE_USE

int main(int argc, char* argv[])
{
    XMLCh ls[] = {chLatin_L, chLatin_S, chNull};
    XMLPlatformUtils::Initialize();

    DOMImplementation* implementation =
        DOMImplementationRegistry::getDOMImplementation(ls);

    DOMBuilder *builder =
        implementation->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0);

    XERCES_CPP_NAMESPACE::DOMDocument *doc = builder->parseURI("sth.xml");
   
    doc->release();
    // here i get a segfault
    builder->release();

    XMLPlatformUtils::Terminate();
    return 0;
}

Reply via email to