Catch more exceptions
This commit is contained in:
parent
0fed15b93b
commit
c61ceec6d0
|
@ -41,6 +41,7 @@
|
||||||
#include <xercesc/validators/common/ContentSpecNode.hpp>
|
#include <xercesc/validators/common/ContentSpecNode.hpp>
|
||||||
#include <xercesc/validators/schema/SchemaSymbols.hpp>
|
#include <xercesc/validators/schema/SchemaSymbols.hpp>
|
||||||
#include <xercesc/validators/DTD/DTDGrammar.hpp>
|
#include <xercesc/validators/DTD/DTDGrammar.hpp>
|
||||||
|
#include <xercesc/dom/DOMException.hpp>
|
||||||
|
|
||||||
using namespace xercesc;
|
using namespace xercesc;
|
||||||
|
|
||||||
|
@ -309,14 +310,13 @@ int XMLCALL XmlPromptGenerator::externalentityrefhandler (
|
||||||
parser.setErrorHandler ( &handler );
|
parser.setErrorHandler ( &handler );
|
||||||
parser.setEntityResolver ( &catalogResolver );
|
parser.setEntityResolver ( &catalogResolver );
|
||||||
|
|
||||||
|
wxString widePublicId = wxString::FromUTF8 ( publicId );
|
||||||
|
wxString wideSystemId = wxString::FromUTF8 ( systemId );
|
||||||
|
|
||||||
Grammar *rootGrammar;
|
Grammar *rootGrammar;
|
||||||
try {
|
try {
|
||||||
wxString wideSystemId = wxString::FromUTF8 ( systemId );
|
|
||||||
std::auto_ptr<InputSource> source ( WrapXerces::resolveEntity
|
std::auto_ptr<InputSource> source ( WrapXerces::resolveEntity
|
||||||
( wxString::FromUTF8 ( publicId )
|
( widePublicId , wideSystemId , d->basePath ) );
|
||||||
, wideSystemId
|
|
||||||
, d->basePath
|
|
||||||
) );
|
|
||||||
if ( !source.get() )
|
if ( !source.get() )
|
||||||
{
|
{
|
||||||
wxLogError ( _T("Cann't open '%s'"), wideSystemId.c_str() );
|
wxLogError ( _T("Cann't open '%s'"), wideSystemId.c_str() );
|
||||||
|
@ -335,6 +335,24 @@ int XMLCALL XmlPromptGenerator::externalentityrefhandler (
|
||||||
wxLogError ( _T ( "%s" ), handler.getErrors().c_str() );
|
wxLogError ( _T ( "%s" ), handler.getErrors().c_str() );
|
||||||
return XML_STATUS_ERROR;
|
return XML_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
catch ( XMLException &e )
|
||||||
|
{
|
||||||
|
wxString error = WrapXerces::toString ( e.getMessage() );
|
||||||
|
wxLogError ( _T ( "%s" ), error.c_str() );
|
||||||
|
return XML_STATUS_ERROR;
|
||||||
|
}
|
||||||
|
catch ( DOMException &e )
|
||||||
|
{
|
||||||
|
wxString error = WrapXerces::toString ( e.getMessage() );
|
||||||
|
wxLogError ( _T ( "%s" ), error.c_str() );
|
||||||
|
return XML_STATUS_ERROR;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
wxLogError ( _T ( "Failed to load: %s %s"), widePublicId.c_str()
|
||||||
|
, wideSystemId.c_str() );
|
||||||
|
return XML_STATUS_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
DTDGrammar* grammar = ( DTDGrammar* ) rootGrammar;
|
DTDGrammar* grammar = ( DTDGrammar* ) rootGrammar;
|
||||||
NameIdPoolEnumerator<DTDElementDecl> elemEnum = grammar->getElemEnumerator();
|
NameIdPoolEnumerator<DTDElementDecl> elemEnum = grammar->getElemEnumerator();
|
||||||
|
|
Loading…
Reference in New Issue