GNOME Bugzilla – Bug 136466
Deleayed SAX events
Last modified: 2009-08-15 18:40:50 UTC
When using push parser with SAX interface with libxml2-2.6.7 startElement and startElemenNs functions are delayed - they are not called when start tag of the element is read, but when another tag is read. This makes it unusable for real-time stream parsing - e.g. XMPP/Jabber stream handling. There was no such problem in 2.6.6 version. Upgrade from 2.6.6 to 2.6.7 breaks PyXMPP library and CJC Jabber client using that library. I wrote simple test-case programs, which also work as expected on 2.6.6, but fail on 2.6.7. The problem exists in both SAX1 and SAX2 interfaces.
Created attachment 25294 [details] Test case
There have *never* been garanteed a that pushing data would generate the callbacks immediately. I never made that garanteed, I stated on request that I would not make such garanteed, the change between 2.6.6 and 2.6.7 fixes a very serious push parsing bug#134566 . Each time someone asked about it w.r.t. Jabber support I stated that expecting the push to flush the events out was not part of the ABI garantee. Sorry having the parser behave correctly is more important, I'm not sure I can "fix" the problem without significant performance problem either. Bug left as NEW, might or might not get fixed, but it's not really a bug, rather an abusive expectation on the API has been changed, that's all Daniel
If you cannot garantee that this will not be broken permanently in some future release, then don't fix this. I can make workaround - parse stream input for single tags (for stream opening) or whole elements (start tag, all children and end tag), before feeding it to libxml2 parser for tree building. This - parsing XML before passing it to XML parser - seems insane for me, and one reason why I choose libxml2 for my XMPP library was the fact, that the silly workaround was not needed in opposite to some other parsers (other reasons were: Python bindings, speed and namespace support).
I think I fixed this in CVS, I added a Python test to make sure this don't get broken in future releases, Daniel
This should be closed in libxml2-2.6.11, thanks, Daniel