Movatterモバイル変換


[0]ホーム

URL:


Menu
Like the tool?
Help making it better!
Your donation helps!
Like the tool?
Help making it better!
Your donation helps!

lxml - XML and HTML with Python

» lxml takes all the pain out of XML. «
Stephan Richter

lxml is the most feature-richand easy-to-use libraryfor processing XML and HTMLin the Python language.

Introduction

The lxml XML toolkit is a Pythonic binding for the C librarieslibxml2 andlibxslt. It is unique in that it combines the speed andXML feature completeness of these libraries with the simplicity of anative Python API, mostly compatible but superior to the well-knownElementTree API. The latest release works with all CPython versionsfrom 3.6 to 3.12. See theintroduction for more information aboutbackground and goals of the lxml project. Some common questions areanswered in theFAQ.

Support the project

lxml has been downloaded from thePython Package Indexmillions of times and is also available directly in many packagedistributions, e.g. for Linux or macOS.

Most people who use lxml do so because they like using it.You can show us that you like it by blogging about your experiencewith it and linking to the project website.

If you are using lxml for your work and feel like giving a bit ofyour own benefit back to support the project, consider sending usmoney through GitHub Sponsors, Tidelift or PayPal that we can useto buy us free time for the maintenance of this great library, tofix bugs in the software, review and integrate code contributions,to improve its features and documentation, or to just take a deepbreath and have a cup of tea every once in a while.Please read the Legal Notice below, at the bottom of this page.Thank you for your support.

Support lxml throughGitHub Sponsors

via aTidelift subscription

or via PayPal:

Donate to the lxml project

Pleasecontact Stefan Behnelfor other ways to support the lxml project,as well as commercial consulting, customisations and trainings on lxml andfast Python XML processing.

Note that we are not accepting donations in crypto currencies.Much of the development and hosting for lxml is done in a carbon-neutral wayor with compensated and very low emissions.Crypto currencies do not fit into that ambition.

AppVeyor andGitHub Actionssupport the lxml project with their build and CI servers.Jetbrains supports the lxml project by donating free licenses of theirPyCharm IDE.Another supporter of the lxml project isCOLOGNE Webdesign.

Documentation

The HTML documentation from this web site is part ofthe normalsource download.

lxml.etree follows theElementTree API as much as possible, buildingit on top of the native libxml2 tree. If you are new to ElementTree,start with thelxml.etree tutorial for XML processing. See also theElementTreecompatibility overview and theElementTree performancepage comparing lxml to the originalElementTree andcElementTreeimplementations.

Right after thelxml.etree tutorial for XML processing and theElementTree documentation, the next place to look is thelxml.etreespecific API documentation. It describes how lxml extends theElementTree API to expose libxml2 and libxslt specific XMLfunctionality, such asXPath,Relax NG,XML Schema,XSLT, andc14n (includingc14n 2.0).Python code can be called from XPath expressions and XSLTstylesheets through the use ofXPath extension functions. lxmlalso offers aSAX compliant API, that works with the SAX support inthe standard library.

There is a separate modulelxml.objectify that implements a data-bindingAPI on top of lxml.etree. See theobjectify and etree FAQ entry for acomparison.

In addition to the ElementTree API, lxml also features a sophisticatedAPI forcustom XML element classes. This is a simple way to writearbitrary XML driven APIs on top of lxml. lxml.etree also has aC-level API that can be used to efficiently extend lxml.etree inexternal C modules, including fast custom element class support.

Download

The best way to download lxml is to visitlxml at the Python PackageIndex (PyPI). It has the sourcethat compiles on various platforms. The source distribution is signedwiththis key.

The latest version islxml 5.3.0, released 2024-08-10(changes for 5.3.0).Older versionsare listed below.

Please take a look at theinstallation instructions !

This complete website (including the generated API documentation) ispart of the source distribution, so if you want to download thedocumentation for offline use, take the source archive and copy thedoc/html directory out of the source tree.

The latestinstallable developer sourcesare available from Github. It's also possible to check outthe latest development version of lxml from Github directly, using a commandlike this:

git clone https://github.com/lxml/lxml.git lxml

You can browse thesource repository and its history throughthe web. Please readhow to build lxml from sourcefirst. Thelatest CHANGES of the developer version are alsoaccessible. You can check there if a bug you found has been fixedor a feature you want has been implemented in the latest trunk version.

Mailing list

Questions? Suggestions? Code to contribute? We have amailing list.

You can alsosearch the archive for past questions and discussions.

Bug tracker

lxml uses thelaunchpad bug tracker. If you are sure you found abug in lxml, please file a bug report there. If you are not surewhether some unexpected behaviour of lxml is a bug or not, pleasecheck the documentation and ask on themailing list first. Do notforget tosearch the archive!

License

The lxml library is shipped under aBSD license. libxml2 and libxslt2itself are shipped under theMIT license. There should therefore be noobstacle to using lxml in your codebase.

Old Versions

See the websites of lxml5.2,5.1,5.0,4.9,4.8,4.7,4.6,4.5,4.4,4.3,4.2,4.1,4.0,3.8,3.7,3.6,3.5,3.4,3.3,3.2,3.1,3.0,2.3,2.2,2.1,2.0,1.3

Project income report

lxml hasabout 80 million downloadsper month on PyPI.

Legal Notice for Donations

Any donation that you make to the lxml project is voluntary andis not a fee for any services, goods, or advantages. By makinga donation to the lxml project, you acknowledge that we have theright to use the money you donate in any lawful way and for anylawful purpose we see fit and we are not obligated to disclosethe way and purpose to any party unless required by applicablelaw. Although lxml is free software, to the best of our knowledgethe lxml project does not have any tax exempt status. The lxmlproject is neither a registered non-profit corporation nor aregistered charity in any country. Your donation may or may notbe tax-deductible; please consult your tax advisor in this matter.We will not publish or disclose your name and/or e-mail addresswithout your consent, unless required by applicable law. Yourdonation is non-refundable.


Generated on: 2024-08-10.

[8]ページ先頭

©2009-2025 Movatter.jp