Unable to parse XML files using SAX2 is not recursive
-----------------------------------------------------

         Key: XERCESC-1387
         URL: http://issues.apache.org/jira/browse/XERCESC-1387
     Project: Xerces-C++
        Type: Bug
  Components: SAX/SAX2  
    Versions: 2.6.0    
 Environment: LINUX
    Reporter: Raj Devanesan


Hi,

I have upgraded my application to use xerces 2_6_0 from 2_2. My application 
recursively evaluates XML files. Following is the code extract

Get()
{
 MsgXmlReader* xmlReader = new MsgXmlReader();
 MsgConfigProcessorSimple processorSimple( config );
 processorSimple.init( file, path );
 xmlReader->addProcessor( &processorSimple );
 xmlReader->process( file );
 delete xmlReader;
}

The process method of XML Reader

//=============================================================================
// process
//=============================================================================
void MsgXmlReader::process( string file ) throw (MsgException)
{
  SAX2XMLReader* parser = NULL;

  try
  {
    XMLPlatformUtils::Initialize();

    parser = XMLReaderFactory::createXMLReader();

    parser->setContentHandler( this );
    parser->setErrorHandler( this );
  
    parser->parse( file.c_str() );

    delete parser;
    parser = NULL;
    
    XMLPlatformUtils::Terminate();
  }
  catch( const XMLException& ex )
  {
    if( parser )
    {
      delete parser;
    }

    THROW( "Failed to parse " << file << ": " << StrX(ex.getMessage()) );
  }
  catch( const SAXException& ex )
  {
    if( parser )
    {
      delete parser;
    }

    THROW( "Failed to parse " << file << ": " << StrX(ex.getMessage()) );
  }
}

I have added a feture to parse any files include by using a include tag
 <include file="xyz.xml/>

When I try to parse the included file the application hangs. 

 MsgXmlReader* xmlReader = new MsgXmlReader();

The above line could not create a new MsgXmlReader. 

Do you know the reason. I tried the samples to do recursive evaluation and it 
works. If you have seen such problem please let me know


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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

Reply via email to