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 "Bovy, Stephen J" <ST...@ca.com> on 2004/04/17 01:08:30 UTC

RE:IN memory Parse with DOMInputSource ?????

I am trying to write some flexable code that can
either do a file parse or an in memory parse, but I am getting a 
compile error  on : doc = sstate->doc =
sstate->parser->parse(*memBufIS);  

See below:

****************************************** 
if ( sfile.ipc ) {                              
                                                
  sstate->pathName [ 0]  = 0;                     
                                                
  sfile.ipc->pbuff  [sfile.ipc->leng]  = 0;       
                                                
  memBufIS = new MemBufInputSource              
  (                                             
      (const XMLByte*) sfile.ipc->pbuff         
      , sfile.ipc->leng                         
      , gMemBufId                               
      , false                                   
  );                                            
                                                
  if ( memBufIS == NULL ) {                     
   hcsRet->code = 8;                            
   hcsRet->reas = 0;                            
   throw 8;                                     
  } // endif no memory available                
                                                
} // endif in-memory parse                      

// Instantiate the DOM parser.                                      
static const XMLCh gLS   = { chLatin_L, chLatin_S, chNull };        
sstate->impl = DOMImplementationRegistry::getDOMImplementation(gLS);
sstate->parser =                                                    
  ((DOMImplementationLS*)sstate->impl)->                            
  createDOMBuilder ( DOMImplementationLS::MODE_SYNCHRONOUS, 0 );    
                                                                    
sstate->parser->setFeature ( XMLUni::fgDOMNamespaces, doNamespaces);
sstate->parser->setFeature ( XMLUni::fgXercesSchema, doSchema );    
sstate->parser->setFeature ( XMLUni::fgXercesSchemaFullChecking,    
                             schemaFullChecking);                   

try                                                          
{                                                            
    // reset document pool                                   
    sstate->parser->resetDocumentPool();                     
                                                             
    if ( sfile.ipc ) {                                       
      doc = sstate->doc = sstate->parser->parse(*memBufIS);  
    } else {                                                 
      doc = sstate->doc = sstate->parser->parseURI(xmlFile); 
    } // endif in memory parse                               

} catch {
*******************************
Basically I am trying to merge the code between DOMPrint and MemParse

and there are some obvious differences that I do not comprehend.

How do I create an in memory parse with  DOMInputSource ????

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