proper error reporting from libxml2
Change-Id: Ia173f7f4c88c90b6d54c9a47d6ae18b933502678
This commit is contained in:
parent
0df9ac47df
commit
1307c65d74
1 changed files with 7 additions and 33 deletions
|
@ -532,46 +532,20 @@ Event& Entity::getEvent( CallbackType aType )
|
|||
return rEvent;
|
||||
}
|
||||
|
||||
OUString lclGetErrorMessage( xmlParserCtxtPtr, const OUString& sSystemId, sal_Int32 nLine )
|
||||
OUString lclGetErrorMessage( xmlParserCtxtPtr ctxt, const OUString& sSystemId, sal_Int32 nLine )
|
||||
{
|
||||
const sal_Char* pMessage = "";
|
||||
#if 0
|
||||
pMessage = "Error";
|
||||
switch( xmlE )
|
||||
{
|
||||
case XML_ERROR_NONE: pMessage = "No"; break;
|
||||
case XML_ERROR_NO_MEMORY: pMessage = "no memory"; break;
|
||||
case XML_ERROR_SYNTAX: pMessage = "syntax"; break;
|
||||
case XML_ERROR_NO_ELEMENTS: pMessage = "no elements"; break;
|
||||
case XML_ERROR_INVALID_TOKEN: pMessage = "invalid token"; break;
|
||||
case XML_ERROR_UNCLOSED_TOKEN: pMessage = "unclosed token"; break;
|
||||
case XML_ERROR_PARTIAL_CHAR: pMessage = "partial char"; break;
|
||||
case XML_ERROR_TAG_MISMATCH: pMessage = "tag mismatch"; break;
|
||||
case XML_ERROR_DUPLICATE_ATTRIBUTE: pMessage = "duplicate attribute"; break;
|
||||
case XML_ERROR_JUNK_AFTER_DOC_ELEMENT: pMessage = "junk after doc element"; break;
|
||||
case XML_ERROR_PARAM_ENTITY_REF: pMessage = "parameter entity reference"; break;
|
||||
case XML_ERROR_UNDEFINED_ENTITY: pMessage = "undefined entity"; break;
|
||||
case XML_ERROR_RECURSIVE_ENTITY_REF: pMessage = "recursive entity reference"; break;
|
||||
case XML_ERROR_ASYNC_ENTITY: pMessage = "async entity"; break;
|
||||
case XML_ERROR_BAD_CHAR_REF: pMessage = "bad char reference"; break;
|
||||
case XML_ERROR_BINARY_ENTITY_REF: pMessage = "binary entity reference"; break;
|
||||
case XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF: pMessage = "attribute external entity reference"; break;
|
||||
case XML_ERROR_MISPLACED_XML_PI: pMessage = "misplaced xml processing instruction"; break;
|
||||
case XML_ERROR_UNKNOWN_ENCODING: pMessage = "unknown encoding"; break;
|
||||
case XML_ERROR_INCORRECT_ENCODING: pMessage = "incorrect encoding"; break;
|
||||
case XML_ERROR_UNCLOSED_CDATA_SECTION: pMessage = "unclosed cdata section"; break;
|
||||
case XML_ERROR_EXTERNAL_ENTITY_HANDLING: pMessage = "external entity reference"; break;
|
||||
case XML_ERROR_NOT_STANDALONE: pMessage = "not standalone"; break;
|
||||
default:;
|
||||
}
|
||||
#endif
|
||||
const sal_Char* pMessage;
|
||||
xmlErrorPtr error = xmlCtxtGetLastError( ctxt );
|
||||
if( error && error->message )
|
||||
pMessage = error->message;
|
||||
else
|
||||
pMessage = "unknown error";
|
||||
OUStringBuffer aBuffer( '[' );
|
||||
aBuffer.append( sSystemId );
|
||||
aBuffer.append( " line " );
|
||||
aBuffer.append( nLine );
|
||||
aBuffer.append( "]: " );
|
||||
aBuffer.appendAscii( pMessage );
|
||||
aBuffer.append( " error" );
|
||||
return aBuffer.makeStringAndClear();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue