Re: [xml] xmlTextReaderExpand() always waits for next successor node



On Thu, Jul 25, 2013 at 09:06:29PM +0200, Felix Geisendoerfer wrote:
Hi,

  Hi Felix,

I'm using the XmlTextReader interface to process a stream of chat
messages (XMPP). The data is coming from a network socket that I've
wired up via xmlReaderForIO().

Problem: xmlTextReaderExpand() does not return until the next
successor node has been received, which means I can never access the
latest message until the next one arrives.

  yup, there is a window of data where the parser won't proceed until
it get more data, and this sometimes doesn't cope well with jabber and
related protocol who where designed with the expectation that all data
are pushed immediately without any chunking (the funny thing is that
they are now considered too CPU hungry, what a surprize :-)

It seems like this problem was previously discussed [1], but no
solution was found.

  yup it is not trivial at all !

After reading through the libxml2 parser code, I think it should be
possible to track if a node has been closed (probably: `case
XML_PARSER_END_TAG` in xmlParseTryOrFinish() [2].), and add another
case in xmlTextReaderDoExpand() that checks for reader->node->closed
[3].

That being said, I'm new to the code base and don't understand why the
current implementation doesn't attempt this already, so I'm wondering
if a patch like this would be accepted and if there are other issues
with it that I'm currently overlooking.

  Please try to come with a patch, I can't 100% guarantee that i will
take it but but I promise to review it :-) Make sure 'make check' still
passes and that there is no regression in testlimits !

Anyway, thank you so much for libxml2!

  My pleasure, but i have far less time for it those days !

Daniel

-- 
Daniel Veillard      | Open Source and Standards, Red Hat
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | virtualization library  http://libvirt.org/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]