You are right, here is the correct approach:

Thanks for the feedback,  I realized though that I was doing the wrong
thing:

Here is the correct approach:

MemBufInputSource* memBufIS = NULL;      
Wrapper4InputSource* domBufIS = NULL;    

memBufIS = new MemBufInputSource                    
(                                                   
    (const XMLByte*) sfile.ipc->pbuff               
    , sfile.ipc->leng                               
    , gMemBufId                                     
    , false                                         
);                                                  
 

domBufIS = new Wrapper4InputSource ( memBufIS );     

if ( sfile.ipc ) {                                        
  doc = sstate->doc = sstate->parser->parse(*domBufIS);   
} else {                                                  
  doc = sstate->doc = sstate->parser->parseURI(xmlFile);  
} // endif in memory parse                                


delete domBufIS; <+++++++++????
delete memBufIS; <++++++++++????? 

My only question is it save to delete the two objects after the parse
and before
I use the dom document ?????
 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 22, 2004 8:41 AM
To: [EMAIL PROTECTED]
Subject: Re: DOMInputSource and BinInputStream ???

> Can I do the following:
>
> class myinput : DOMInputSource, BinMemInputStream {
>
> public:
>
>   myinput ( ) { };
>
>  ~myinput ( ) { };
>
>  BinInputStream* makestream ( ) { return this };
>
> }

You shouldn't do this, because the parser will want to delete the
BinMemInputStream instance, and I don't think there's any guarantee the
parser won't try to access to DOMInputSource instance after it has
deleted the stream.

As an side, perhaps you meant to derive from DOMInputSource using public
inheritence, rather than private?

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to