
June 14, 2014
1:24 a.m.
Phil Mayers, 11.06.2014 19:34:
I'm using lxml to parse Junoscript, which is a protocol that's a single infinite XML document, a bit like XMPP. It goes:
<junoscript> <pdu>...</pdu> <pdu>...</pdu> <pdu>...</pdu>
I've been using the construct:
parser = XMLParser(target=SomeClass()) while getdata(): parser.feed(data)
[...] Does lxml have any API I can use to handle this, and that also has a push interface? Note I cannot let lxml read or block, since it's being used in an async fashion. I need to push the data in, and get notifications of tag start/end events as soon as the full open/close has happened.
http://lxml.de/parsing.html#incremental-event-parsing Also see recent threads on this list that mention XMPP. Stefan