lxml is one of the best ways of parsing XML in Python. It is not trivial to install on all platforms however.
$ sudo apt-get install libxslt1.1 libxslt1-dev libxml2-dev libxml2
$ sudo pip install Cython $ sudo pip install lxml
Install Cython
sudo easy_install Cython
The version of libxml2 that comes with Leopard is too old.
./configure --prefix=/usr/local/libxml2-2.7.1 make sudo make install cd /Library/Python/2.5/site-packages sudo ln -s /usr/local/libxml2-2.7.1/lib/python2.5/site-packages/* .
The version of libxslt that comes with Leopard is too old.
./configure --prefix=/usr/local/libxslt-1.1.24 --with-libxml-prefix=/usr/local/libxml2-2.7.1 make sudo make install cd /Library/Python/2.5/site-packages sudo ln -s /usr/local/libxslt-1.1.24/lib/python2.5/site-packages/* .
Download and install lxml
sudo python setup.py install \ --with-xml2-config=/usr/local/libxml2-2.7.1/bin/xml2-config \ --with-xslt-config=/usr/local/libxslt-1.1.24/bin/xslt-config
Mostly taken from
http://lsimons.wordpress.com/2008/08/31/how-to-install-lxml-python-module-on-mac-os-105-leopard/