This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eli.bendersky
Recipients Aaron.Oakley, docs@python, eli.bendersky, python-dev
Date 2013-08-27.03:41:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAF-Rda9A8JPzWGrpFr_YTFSxwmUtFQcSE8xvs_voftQdwou3_w@mail.gmail.com>
In-reply-to <1377569480.34.0.0904623844155.issue17902@psf.upfronthosting.co.za>
Content
On Mon, Aug 26, 2013 at 7:11 PM, Aaron Oakley <report@bugs.python.org>wrote:

>
> Aaron Oakley added the comment:
>
> >From memory, the use case at the time was using a custom TreeBuilder
> sub-class fed into a builtin XMLParser object. The code would construct a
> builder separately and keep a reference to it around. The builder would
> delegate calls to start(), data(), end(), and close() to super and save the
> completed tree when its close() was called.
>
>     my_builder = CustomTreeBuilder()
>     et_parser = ET.XMLParser(target=my_builder)
>
>     for (evt, elem) in ET.iterparse("...", events, parser=et_parser):
>         pass  # Do first processing
>
>     tree = my_builder.root  # Saved tree
>
> It was done like this initially so that some data (I can't recall exactly
> what) from the XML input could be processed first very conveniently using
> the parse events from iterparse while allowing the whole tree to be
> retrieved afterwards.
>
> That said, the project later moved to using lxml for various features not
> contained in xml.etree.ElementTree, and I don't think the process I
> described is still being used.
>

Thanks for the information, Aaron; much appreciated.
History
Date User Action Args
2013-08-27 03:41:41eli.benderskysetrecipients: + eli.bendersky, docs@python, python-dev, Aaron.Oakley
2013-08-27 03:41:41eli.benderskylinkissue17902 messages
2013-08-27 03:41:41eli.benderskycreate