diff options
Diffstat (limited to 'sax/source')
-rw-r--r-- | sax/source/fastparser/fastparser.cxx | 40 |
1 files changed, 7 insertions, 33 deletions
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index e1d22d215f78..bf3aa01456d0 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -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(); } |