Reputation: 154584
How can I make sure that my Python script, which will be doing some XML parsing, will Just Work with Python 2.4, 2.5 and 2.6?
Specifically, which (if any) XML parsing library is present in, and compatible between, all those versions?
Edit: the working-out-of-the-box requirement is in place because the XML parsing I'm going to need to do is very limited (just grabbing some values) and I'm going to need to run this script on a bunch of different platforms, so I'd rather deal with a crappy XML API then try to get lxml
installed on Mac, Linux and Windows.
Upvotes: 7
Views: 2959
Reputation: 11744
So, basically intersect the result of "xml" in these pages:
That leaves xml.dom
and xml.sax
.
If you could relieve the "out-of-the-box"-requirement: lxml
Upvotes: 5
Reputation: 3550
minidom is available in Python 2.0 and later.
However, if I were you, I would strongly consider using ElementTree which is available in Python 2.5 and later. Its syntax is much more pleasant.
2.4 users can reasonably easily download ElementTree, 2.5+ it will work without any additional dependencies. But I may be spoiled by rarely needing to target pre-2.5, myself.
Upvotes: 8