[issue18902] Make ElementTree event handling more modular to allow custom targets for the non-blocking parser

Stefan Behnel report at bugs.python.org
Fri Sep 13 08:18:29 CEST 2013


Stefan Behnel added the comment:

The way the XMLPullParser is implemented in lxml.etree now is that it simply inherits from XMLParser. This would also make sense for ElementTree, even before supporting arbitrary targets. The patch in ticket #18990 makes this simple to do.

For reference, here is the implementation in lxml.

Iterparse:

https://github.com/lxml/lxml/blob/master/src/lxml/iterparse.pxi

XMLPullParser:

https://github.com/lxml/lxml/blob/d9f7cd8d12a27cafc4d65c6e280ea36156e3b837/src/lxml/parser.pxi#L1357

SAX based parser that collects events and/or maps parser callbacks to callbacks on the target object:

https://github.com/lxml/lxml/blob/master/src/lxml/saxparser.pxi

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18902>
_______________________________________


More information about the Python-bugs-list mailing list