Skip to main content

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

Project description

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

In case you want to use the current in-development version of lxml, you can get it from the subversion repository at . Running easy_install lxml==dev will install it from

2.1alpha1 (2008-03-27)

Features added

  • New event types ‘comment’ and ‘pi’ in iterparse().

  • XSLTAccessControl instances have a property options that returns a dict of access configuration options.

  • Constant instances DENY_ALL and DENY_WRITE on XSLTAccessControl class.

  • Extension elements for XSLT (experimental!)

  • Element.base property returns the xml:base or HTML base URL of an Element.

  • docinfo.URL property is writable.

Bugs fixed

  • Default encoding for plain text serialisation was different from that of XML serialisation (UTF-8 instead of ASCII).

Other changes

  • Minor API speed-ups.

  • The benchmark suite now uses tail text in the trees, which makes the absolute numbers incomparable to previous results.

  • Generating the HTML documentation now requires Pygments, which is used to enable syntax highlighting for the doctest examples.

Most long-time deprecated functions and methods were removed:

  • etree.clearErrorLog(), use etree.clear_error_log()

  • etree.useGlobalPythonLog(), use etree.use_global_python_log()

  • etree.ElementClassLookup.setFallback(), use etree.ElementClassLookup.set_fallback()

  • etree.getDefaultParser(), use etree.get_default_parser()

  • etree.setDefaultParser(), use etree.set_default_parser()

  • etree.setElementClassLookup(), use etree.set_element_class_lookup()

    Note that parser.setElementClassLookup() has not been removed yet, although parser.set_element_class_lookup() should be used instead.

  • xpath_evaluator.registerNamespace(), use xpath_evaluator.register_namespace()

  • xpath_evaluator.registerNamespaces(), use xpath_evaluator.register_namespaces()

  • objectify.setPytypeAttributeTag, use objectify.set_pytype_attribute_tag

  • objectify.setDefaultParser(), use objectify.set_default_parser()

Project details

Release history Release notifications | RSS feed

Download files

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

Source Distribution

lxml-2.1alpha1.tar.gz (2.1 MB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page