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.
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.
