Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.
lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. It provides safe and convenient access to these libraries using the ElementTree API.
It extends the ElementTree API significantly to offer support for XPath, RelaxNG, XML Schema, XSLT, C14N and much more.
To contact the project, go to the project home page or see our bug tracker at https://launchpad.net/lxml
In case you want to use the current in-development version of lxml, you can get it from the subversion repository at http://codespeak.net/svn/lxml/trunk . Running easy_install lxml==dev will install it from http://codespeak.net/svn/lxml/trunk#egg=lxml-dev
New properties position and code on ParseError exception (as in ET 1.3)
Memory leak in the parse() function.
Minor bugs in XSLT error message formatting.
Result document memory leak in target parser.
Various places in the XPath, XSLT and iteration APIs now require keyword-only arguments.
The argument order in element.itersiblings() was changed to match the order used in all other iteration methods. The second argument (‘preceding’) is now a keyword-only argument.
The getiterator() method on Elements and ElementTrees was reverted to return an iterator as it did in lxml 1.x. The ET API specification allows it to return either a sequence or an iterator, and it traditionally returned a sequence in ET and an iterator in lxml. However, it is now deprecated in favour of the iter() method, which should be used in new code wherever possible.
The ‘pretty printed’ serialisation of ElementTree objects now inserts newlines at the root level between processing instructions, comments and the root tag.
A ‘pretty printed’ serialisation is now terminated with a newline.
Second argument to lxml.etree.Extension() helper is no longer required, third argument is now a keyword-only argument ns.
lxml.html.tostring takes an encoding argument.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.