I use ElementTree as my XML library of choice in Python, but sometimes it is lacking in what I need it to do. I have always found its support for namespaces to be awkward to use, and recently I needed to validate generated XML against a collection of XML schemas, but ElementTree has no support for this.
So I had a hunt around and discovered lxml, a Python XML library that -- not only appears to actively developed -- provides good compatibility with ElementTree while layering on additional functionality.
The only downside to lxml is that it requires both libxml2 and libxslt to be installed, though if you install from the binary egg, it includes these libraries, making it very straightforward to run on Windows. On the Mac, you might need to upgrade the libraries, which can be a chore, though using MacPorts makes life easier.
No comments:
Post a Comment