You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Andreas Karlsson <an...@yahoo.se> on 2004/05/21 13:11:23 UTC

Multiple DOMDocuments for same DOMBuilder

When I use the same DOMBuilder object for parsing
several XML files, thus building several DOM trees for
the same parser, the latter document gets an illegal
pointer and there is no way of accessing the
DOMDocument. Could this be happening due to an old
version of Xerces (2.1.0.)?
 
Further more; is there any way of separating
DOMDocuments from their DOMBuilder object, or is there
a way of deleteing specific DOMDocuments belonging to
the same DOMBuilder object? I am writing an
application that supports up to 10 000 users and I
wouldn't want to use a new DOMBuilder object for every
user, just the DOMDocument.


Höstrusk och grå moln - köp en resa till solen på Yahoo! Resor på adressen http://se.docs.yahoo.com/travel/index.html

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Multiple DOMDocuments for same DOMBuilder

Posted by Andreas Karlsson <an...@yahoo.se>.
 --- Alberto Massari <am...@progress.com> skrev: >
At 14.45 21/05/2004 +0200, Andreas Karlsson wrote:
> > > Hi,
> > >
> > >
> > > On Fri, 21 May 2004, [iso-8859-1] Andreas
> Karlsson
> > > wrote:
> > >
> > > > When I use the same DOMBuilder object for
> parsing
> > > > several XML files, thus building several DOM
> trees
> > > for
> > > > the same parser, the latter document gets an
> > > illegal
> > > > pointer and there is no way of accessing the
> > > > DOMDocument. Could this be happening due to an
> old
> > > > version of Xerces (2.1.0.)?
> > >
> > > Could be, but try calling reset.
> > >
> > > >
> > > > Further more; is there any way of separating
> > > > DOMDocuments from their DOMBuilder object,
> > >
> > > yes, adoptDocument
> > >
> >
> >This may be a inept question but how do you
> construct
> >a AbstractDOMParser in order to adoptDocument?
> 
> adoptDocument is available on the XercesDOMParser
> parser; if you want to 
> use the DOML3-compliant DOMBuilder, you have to
> invoke 
>
DOMBuilder::setFeature(XMLUni::fgXercesUserAdoptsDOMDocument,
> true) and the 
> DOMDocument returned by parse() will not be stored
> inside the DOMBuilder 
> (clearly you will be responsible for deleting it).

Thank you! That made my day!
> 
> Alberto 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> xerces-c-dev-help@xml.apache.org
>  

Höstrusk och grå moln - köp en resa till solen på Yahoo! Resor på adressen http://se.docs.yahoo.com/travel/index.html

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Multiple DOMDocuments for same DOMBuilder

Posted by Alberto Massari <am...@progress.com>.
At 14.45 21/05/2004 +0200, Andreas Karlsson wrote:
> > Hi,
> >
> >
> > On Fri, 21 May 2004, [iso-8859-1] Andreas Karlsson
> > wrote:
> >
> > > When I use the same DOMBuilder object for parsing
> > > several XML files, thus building several DOM trees
> > for
> > > the same parser, the latter document gets an
> > illegal
> > > pointer and there is no way of accessing the
> > > DOMDocument. Could this be happening due to an old
> > > version of Xerces (2.1.0.)?
> >
> > Could be, but try calling reset.
> >
> > >
> > > Further more; is there any way of separating
> > > DOMDocuments from their DOMBuilder object,
> >
> > yes, adoptDocument
> >
>
>This may be a inept question but how do you construct
>a AbstractDOMParser in order to adoptDocument?

adoptDocument is available on the XercesDOMParser parser; if you want to 
use the DOML3-compliant DOMBuilder, you have to invoke 
DOMBuilder::setFeature(XMLUni::fgXercesUserAdoptsDOMDocument, true) and the 
DOMDocument returned by parse() will not be stored inside the DOMBuilder 
(clearly you will be responsible for deleting it).

Alberto 



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Multiple DOMDocuments for same DOMBuilder

Posted by Andreas Karlsson <an...@yahoo.se>.
> Hi,
> 
> 
> On Fri, 21 May 2004, [iso-8859-1] Andreas Karlsson
> wrote:
> 
> > When I use the same DOMBuilder object for parsing
> > several XML files, thus building several DOM trees
> for
> > the same parser, the latter document gets an
> illegal
> > pointer and there is no way of accessing the
> > DOMDocument. Could this be happening due to an old
> > version of Xerces (2.1.0.)?
> 
> Could be, but try calling reset.
> 
> >  
> > Further more; is there any way of separating
> > DOMDocuments from their DOMBuilder object,
> 
> yes, adoptDocument
> 

This may be a inept question but how do you construct
a AbstractDOMParser in order to adoptDocument?

> > or is there
> > a way of deleteing specific DOMDocuments belonging
> to
> > the same DOMBuilder object?
> 
> no, only all of them via resetDocumentPool.
> 
> Gareth
> 
> -- 
> Gareth Reakes, Managing Director      Parthenon
> Computing
> +44-1865-811184                 
> http://www.parthcomp.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> xerces-c-dev-help@xml.apache.org
>  

Höstrusk och grå moln - köp en resa till solen på Yahoo! Resor på adressen http://se.docs.yahoo.com/travel/index.html

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Multiple DOMDocuments for same DOMBuilder

Posted by Gareth Reakes <ga...@parthenoncomputing.com>.
Hi,


On Fri, 21 May 2004, [iso-8859-1] Andreas Karlsson wrote:

> When I use the same DOMBuilder object for parsing
> several XML files, thus building several DOM trees for
> the same parser, the latter document gets an illegal
> pointer and there is no way of accessing the
> DOMDocument. Could this be happening due to an old
> version of Xerces (2.1.0.)?

Could be, but try calling reset.

>  
> Further more; is there any way of separating
> DOMDocuments from their DOMBuilder object,

yes, adoptDocument

> or is there
> a way of deleteing specific DOMDocuments belonging to
> the same DOMBuilder object?

no, only all of them via resetDocumentPool.

Gareth

-- 
Gareth Reakes, Managing Director      Parthenon Computing
+44-1865-811184                  http://www.parthcomp.com

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org