Python's ElementTree is the kind of library you can hold up and point at to demonstrate how much it sucks to manipulate XML; not because manipulating XML sucks, but because ElementTree's approach sucks.

It's literally a strawman argument, embodied in API form.

@mjog the best XML manipulation you can have out there is by using a serde (rust crate) based XML library like quick-xml. You just have to define a struct that represents your tree and voila. I have played with it recently and was very surprised with the end result as my parser worked in almost every edge case without having to re-write everything each time I discovered a missing or optional tag.

@bilelmoussaoui Oh nice, maybe this is finally the excuse I have been looking for to learn Rust?

A long time ago I wrote an XPath-based XML API for Java that worked really well (given the constraints of the language).

While it's entirely possible to write an XML API that works well, it's pretty surprising Python didn't manage to do that in its stdlib.

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!