diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-01-12 12:39:28 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-01-12 12:39:28 +0200 |
commit | b869f81fd4206487efee0a599fb53e1a8ac664ab (patch) | |
tree | 6e3fa26c86c7c320ea5dfb073ed91a2a195edbb2 /libxsde | |
parent | 9aaa002bf85e75bae1228af620987ae8743a267a (diff) |
Work around corner case problem with aborting finished parser
Diffstat (limited to 'libxsde')
-rw-r--r-- | libxsde/xsde/cxx/parser/expat/document.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libxsde/xsde/cxx/parser/expat/document.cxx b/libxsde/xsde/cxx/parser/expat/document.cxx index 2c3f444..2ebde82 100644 --- a/libxsde/xsde/cxx/parser/expat/document.cxx +++ b/libxsde/xsde/cxx/parser/expat/document.cxx @@ -426,7 +426,18 @@ namespace xsde { XML_Error e (XML_GetErrorCode (xml_parser_)); + // While we always stop the parser in case of an error, there + // is a situation where the parsing is by then finished + // (specifically, the end event for the root element for XML + // that does not contain any characters after the root element). + // For this reason we have to check both the XML error code and + // the context. + // +#if defined(XSDE_PARSER_VALIDATION) || !defined (XSDE_EXCEPTIONS) + if (e == XML_ERROR_NONE && !context_.error_type ()) +#else if (e == XML_ERROR_NONE) +#endif { clear (); xml_parser_ = 0; @@ -441,7 +452,11 @@ namespace xsde // See if the parser was aborted. // +#if defined(XSDE_PARSER_VALIDATION) || !defined (XSDE_EXCEPTIONS) + if (e == XML_ERROR_ABORTED || context_.error_type ()) +#else if (e == XML_ERROR_ABORTED) +#endif { #ifdef XSDE_ENCODING_ISO8859_1 if (xml_error_ != 0) |