Skip to main content

Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.

Project description

lxml is a Pythonic 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.

1.0 (2006-06-01)

Features added

See also the features added for lxml 1.0beta to find out more about what’s new.

  • Element.getiterator() and the findall() methods support finding arbitrary elements from a namespace (pattern {namespace}*)
  • Another speedup in tree iteration code
  • General speedup of Python Element object creation and deallocation
  • Writing C14N no longer serializes in memory (reduced memory footprint)
  • PyErrorLog for error logging through the Python logging module
  • element.getroottree() returns an ElementTree for the root node of the document that contains the element.
  • ElementTree.getpath(element) returns a simple, absolute XPath expression to find the element in the tree structure
  • Error logs have a last_error attribute for convenience
  • Comment texts can be changed through the API

Bugs fixed

  • Memory leak in Element.__setitem__
  • Memory leak in Element.attrib.items() and Element.attrib.values()
  • Memory leak in XPath extension functions
  • Memory leak in unicode related setup code
  • Element now raises ValueError on empty tag names
  • Namespace fixing after moving elements between documents could fail if the source document was freed too early
  • Setting namespace-less tag names on namespaced elements (‘{ns}t’ -> ‘t’) didn’t reset the namespace
  • Unknown constants from newer libxml2 versions could raise exceptions in the error handlers
  • lxml.etree compiles much faster
  • On libxml2 <= 2.6.22, parsing strings with encoding declaration could fail in certain cases
  • Document reference in ElementTree objects was not updated when the root element was moved to a different document
  • Running absolute XPath expressions on an Element now evaluates against the root tree
  • Evaluating absolute XPath expressions (/*) on an ElementTree could fail
  • Crashes when calling XSLT, RelaxNG, etc. with uninitialized ElementTree objects
  • Memory leak when using iconv encoders in tostring/write
  • Deep copying Elements and ElementTrees maintains the document information
  • Serialization functions raise LookupError for unknown encodings
  • Memory deallocation crash resulting from deep copying elements

Project details

Release history Release notifications

This version
History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
lxml-1.0-py2.3-linux-i686.egg (162.1 kB) Copy SHA256 hash SHA256 Egg 2.3
lxml-1.0-py2.4-freebsd-6.1-RELEASE-i386.egg (173.8 kB) Copy SHA256 hash SHA256 Egg 2.4
lxml-1.0-py2.4-linux-i686.egg (162.0 kB) Copy SHA256 hash SHA256 Egg 2.4
lxml-1.0-py2.4-linux-x86_64.egg (167.1 kB) Copy SHA256 hash SHA256 Egg 2.4
lxml-1.0-py2.4-macosx-10.4-ppc.egg (346.6 kB) Copy SHA256 hash SHA256 Egg 2.4
lxml-1.0-py2.4-win32.egg (147.2 kB) Copy SHA256 hash SHA256 Egg 2.4
lxml-1.0-static.win32-py2.4.exe (1.3 MB) Copy SHA256 hash SHA256 Windows Installer 2.4
lxml-1.0.tar.gz (365.5 kB) Copy SHA256 hash SHA256 Source None
lxml-1.0.win32-py2.4.exe (207.0 kB) Copy SHA256 hash SHA256 Windows Installer 2.4

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page