Which one is the best XML-parser?

lorenzo.gatti at gmail.com lorenzo.gatti at gmail.com
Fri Jun 24 03:33:13 EDT 2016


On Thursday, June 23, 2016 at 11:03:18 PM UTC+2, David Shi wrote:
> Which one is the best XML-parser?
> Can any one tell me?
> Regards.
> David

Lxml offers lxml.etree.iterparse (http://lxml.de/tutorial.html#event-driven-parsing), an important combination of the memory savings of incremental parsing and the convenience of visiting a DOM tree without dealing with irrelevant details. 
An iterable incrementally produces DOM element objects, which can be deleted after processing them and before proceeding to parse the rest of the document. 
This technique allows easy processing of huge documents containing many medium-size units of work whose DOM trees fit into memory easily. 


More information about the Python-list mailing list