ElementTree is a Python library for creating and parsing XML.


Lxml is a full-featured, high performance Python library for processing XML and HTML.

Application speed effective


"But in general you will find that lxml is faster more effective and has an api which adheres closely to a python standard the elementtree which comes with the python standard library"

from question  

HTML Parser In Python without fixing HTML

"Lxml is faster than elementtree but i ve never found an application where the speed boost paid for the hassles of distribution"

from question  

Use lxml in Maya 2013?



Python 3.6 output i prefer lxml over elementtree because of better xpath support but elementtree is another option same output as above .

from question  

Append text to xml tag value

Note please do tell me if lxml is more easy or this elementtree

from question  

Create XML file with python?

The namespace map passed to element and subelement another lxml extension maps that uri to a prefix which is used for the output;python s standard elementtree library doesn t support cdata sections so you ll need to make sure you re using lxml

from question  

Adding SOAP Envelope to ElementTree generated XML

Update based on the new information that lxml.html is the parsing library lxml doesn t use pure xpath in the same way pure xml libraries might;instead it s a marriage of xpath and the elementtree elementtree that s common to a lot of python xml html parsing libraries salted with a handful of its own homespun approaches

from question  

XPath not "seeing" the img element?

The lxml library uses the same elementtree but offers more control over the output

from question  

Use Python to edit XML header

Lxml is a much better library but if external dependencies are not allowed this will have to do;if you must use elementtree and not lxml

from question  

How to get the IP address from a nmap output in XML with an specific vendor using ElementTree in Python

T provides a nice easy-to-use binding for libxml2 and libxslt and it also implements the elementtree;libxml2 libxslt also come with their own much lower-level python bindings but lxml is much more straightforward and pythonic and it seems to have great performance as well

from question  

Does Python 2.5 include a package to natively transform an XML document?

Updated to be well-formed python output if you re able to use lxml it has much better xpath support than elementtree

from question  

Remove a container in XML

Lxml -- 100x better than elementtree

from question  

What pure Python library should I use to scrape a website?

I wouldn t say that lxml is faster than et across the board as both modules offer tons of functionality;to provide a little context elementtree also supports xpath but particularly et has a unique and useful function called iterparse that remakes the xml document as an iterable

from question  

What are the differences between lxml and ElementTree?

Back to Home
Data comes from Stack Exchange with CC-BY-SA-4.0