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



Hi,

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.

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

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.

Anyway, thank you so much for libxml2!

Cheers,
--
Felix Geisendörfer (felixge.de)

[1]: https://mail.gnome.org/archives/xml/2011-August/msg00009.html
[2]: https://git.gnome.org/browse/libxml2/tree/parser.c#n11560
[3]: https://git.gnome.org/browse/libxml2/tree/xmlreader.c#n1192


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