Bug 84237 - Method setErrorHandler in documentbuilder not working
Summary: Method setErrorHandler in documentbuilder not working
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Libreoffice (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Not Assigned
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 39625
  Show dependency treegraph
 
Reported: 2014-09-23 10:00 UTC by Tobias Madl
Modified: 2014-09-25 23:04 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Tobias Madl 2014-09-23 10:00:05 UTC
===Method setErrorHandler not working===

Background:
To make some CppUnit Tests working (Bug 39625), it was one task to fix the unoxml/test/domtest.cxx. But this test depends on the possibility to overwrite the Errorhandler of the parser (unoxml/source/dom/documentbuilder.cxx: method: setErrorHandler). In order to make this test working again, this method has to be fixed. At the moment it looks like the passed errorhandler is overwritten or even not used at all. For reproduction you can uncomment the method errorInputTest() in unoxml/test/domtest.cxx and run the test, and it will throw exeptions, because the wrong errorhandler is used.

More Information:
The DocumentBuilder wrapps the SAX parser and the SAX parser wrapps the external expat library.

The domtest.cxx is for testing the parser with different xml snippets. It was designed for checking valid input, warnings, errors and fatal errors in the xml.
There are still some more tests in it, but for now they are commented out.
Comment 1 Matúš Kukan 2014-09-25 23:04:55 UTC
Hmm, so I had a look and unoxml is wrapper around libxml2 library, not expat.
From sax, it uses only FastAttributeList.

It should be easy to fix this, have a look at warning_func in
unoxml/source/dom/documentbuilder.cxx
It has pContext->_private = this
so one could do some casting magic and use m_xErrorHandler in warning_func / error_func. Not sure if there is also fatalerror in xmlParserCtxt::sax - quite possibly there is and could be added too.

OTOH if it's not used already, it does not make sense to add this only for a unit test.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.