Fast and capable XML parser?

Steven Bethard steven.bethard at gmail.com
Fri Apr 20 12:25:08 EDT 2007


Magnus Lycka wrote:
> I'm looking for some library to parse XML code
> much faster than the libs built into Python 2.4
> (I'm stuck with 2.4 for quite a while) and I
> also need XML Schema validation, and would
> appreciate support for e.g. XPath and XInclude.
> I also want an API which is more Pythonic than
> e.g. a thin wrapper over a C or C++ API.

For a more Pythonic API, you probably want to look at cElementTree which 
is now in the Python 2.5 stdlib. You can get it standalone from here:

     http://effbot.org/downloads/#cElementTree

This implementation doesn't fully support XSLT, XPath, etc. but lxml 
exposes an ElementTree-style API through lxml.etree, and does, I 
believe, support many of these other things:

     http://codespeak.net/lxml/

I don't know too much about lxml's speed, but since it's a wrapper to 
the libxml2 and libxslt libraries, it should be reasonably fast.

STeVe



More information about the Python-list mailing list