What's the best way to parse HTML/XML efficiently with lxml Python? or How do you handle large XML fi

20 Replies, 1003 Views

If you’re parsing *and* modifying, `etree` is better. The `html` module can get weird with changes.

For speed, disable DTD validation (`parser = etree.XMLParser(resolve_entities=False)`). Huge perf boost.

`iterparse()` is a must for huge files, but yeah, it’s a pain to set up.

Messages In This Thread



Users browsing this thread: 1 Guest(s)