xerces-c-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alberto Massari <amass...@datadirect.com>
Subject RE: why does DOMBuilderImpl::loadGrammar releases my DOMDocument?
Date Wed, 23 Aug 2006 09:34:36 GMT
At 12.25 23/08/2006 +0200, Ori Doolman wrote:
>I don't think it is true, since I have no problem parsing several XML
>files and have several documents at the same time - the DOMBuilder has
>an internal vector of documents in which it keeps the old parsed
>documents.
>The problem arises only when I parse a schema (use loadGrammer).

Hi Ori,
you are right; I was under the impression that loadGrammar internally 
used the fDocument pointer to store the DOM tree of the schema being 
loaded, but that's not true. You can safely delete those 3 lines from 
all the loadGrammar variants.

Thanks for taking the time to report this bug,
Alberto

>Ori.
>
>
>-----Original Message-----
>From: 4pzbrog02@sneakemail.com [mailto:4pzbrog02@sneakemail.com]
>Sent: Wednesday, August 23, 2006 11:07 AM
>To: c-users@xerces.apache.org
>Subject: Re: why does DOMBuilderImpl::loadGrammar releases my
>DOMDocument?
>
>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.
> >
> >
> >


Mime
View raw message