Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.
Actively maintained. Last release 2 days ago, commits in 18 of the last 26 weeks. A safe choice.
$
pip install lxmllxml 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 <https://lxml.de/>`_
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 github repository at
https://github.com/lxml/lxml . Note that this requires Cython to
build the sources, see the build instructions on the project home page.
After an official release of a new stable series, bug fixes may become available at
https://github.com/lxml/lxml/tree/lxml-6.2 .
Running ``pip install https://github.com/lxml/lxml/archive/refs/heads/lxml-6.2.tar.gz``
will install the unreleased branch state as soon as a maintenance branch has been established.
Note that this requires Cython to be installed at an appropriate version for the build.
6.2.0 (2026-11-27)
==================
This release contains several security fixes. Upgrading is recommended.
Bugs fixed
----------
* GHSA-23p9-v872-36p9: Passing ``CDATA()`` wrapped content ending with a bare ``]`` character
into an ``xmlfile`` reads arbitrary data from the Python heap and includes it in the generated XML document.
This allows reading random content from the application memory and/or crashing the application.
Issue found by shaggitza.
* GHSA-59qx-3jjv-x996: Parsing a document defining a non-wellformed entity with the default configuration
of ``iterparse()`` could crash the application.
This issue is network exploitable if the application parses untrusted documents from remote sites.
Issue found by Claude and Ada Logics.
* GHSA-27mw-m39x-fm32: Comments and PIs from the internal/external DTD subsets were reported
through the SAX/target-parser and iterparse/pull parser interfaces which could lead to internal
memory corruption and crashes. They are no longer reported.
Issue found by Claude and Ada Logics.
* GH#550: The output of ``htmldiff()`` could contain unescaped links, allowing for content injection.
Patch by Nayana-Naik73.
* LP#2011542: A processing instruction after the root element crashed ``lxml.sax.ElementTreeContentHandler``
with ``IndexError``. It is now kept as following sibling.
Patch by cherith.
* LP#2175761: Resolvers that returned a string with a ``base_url`` leaked a copy of the URL with
libxml2 2.14 and later.
Patch by Pierre-Yves Le Borgne.
* GH#546: ``lxml.html.diff`` is a bit more stable on PyPy.
Patch by Matti Picus.
* The souppoarser did not immediately close the file after parsing if it opened it.
* The parallel ``make`` execution during library build could fail
when it tries to request more CPUs than available.
* LP#2175761: The C code that Cython generates for ``lxml.etree`` no longer depends on ``PYTHONHASHSEED``.
The exact C types that Cython inferred for some untyped variables was not deterministic.
It is now statically declared.
Patch by Pierre-Yves Le Borgne.
Other changes
-------------
* The binary wheels include several security relevant bug fixes for libxml2 on all platforms.
https://github.com/lxml/lxml/blob/lxml-6.2.0/libxml2-2.14.6-backport1.patch
https://github.com/lxml/lxml/blob/lxml-6.2.0/libxslt-1.1.43-backport1.patch
https://github.com/lxml/libxml2-win-binaries/releases/tag/2026.11.23
* Built with Cython 3.3.2.
Wheels for Python 3.8/3.9 use Cython 3.2.9.