Hello,
Any news about that?
The only thing I can think of for solving this is to allocate another
DOMBuilder parser, and use it for schema purposes only. I think that
separating the schema grammar parsing (loadGrammar) from my XML parsing
is a reasonable workaround.
Also, I think it should be reported as a bug.
What do you think?


-----Original Message-----
From: Ori Doolman 
Sent: Monday, August 21, 2006 2:54 PM
To: [email protected]
Subject: RE: why does DOMBuilderImpl::loadGrammar releases my
DOMDocument?

Axel,
I tried calling adoptDocument myself before loadGrammar, and it still
doesn't help. 
I don't understand why loadGrammar should release any document at all
(and my parsed XML doc in particular).


-----Original Message-----
From: Axel Wei? [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 21, 2006 9:39 AM
To: [email protected]
Subject: Re: why does DOMBuilderImpl::loadGrammar releases my
DOMDocument?

Ori Doolman wrote:
> 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?

Ori,

AFAIK you can call adoptDocument() yourself and release the doc after
use.

HTH,
                        Axel



Reply via email to