The DOM parser actually owns the document you parsed. If you want to hold more than one document in memory, create more than one parser instance, because each will only hold one document instance.

Cheers,

Uwe

Ori Doolman OriD-at-SigValue.com |xerces-c-users mailing list| schrieb:
Hello,

I'm parsing xml files using Xerces-c 2.7 DOM.

I do the following things (more or less):

1.      create a XMLGrammarPoolImpl object and then create a new
DOMBuilder using it as an input.
2.      parse an xml file using the DOMBuilder and keep a reference to
the DOMDocument, 'doc1'
3.      parse another XML file using the same DOMBuilder and keep a
reference to the DOMDocument 'doc2'
4.      Create a new DOMInputSource and call DOMBuilder
->loadGrammar(inputSrc, SchemaGrammarType, true)

The result is that my previous parsed document, 'doc2' is being released
by the following code in parsers\DOMBuilderImpl.cpp on
DOMBuilderImpl::loadGrammar  (line 703):

        // Release DOM tree - DTD

        DOMDocument* doc = adoptDocument();

        if (doc)

            doc->release();

Can someone explain why my document is being release and how to overcome
that? Is it a bug?

Thank you,

Ori.



Reply via email to