Hi,

even if not documented for lxml, findall will follow the ElementTree API:

Finds all matching subelements, by tag name or path. Returns a list containing 
all matching elements in document order.  namespaces is an optional mapping 
from namespace prefix to full name. Pass '' as prefix to move all unprefixed 
tag names in the expression into the given namespace.

https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.findall

(effbot.org seems to be on hiatus).


jens


> On 12. 10. 2021, at 10:49, Eero Holmström <eero.holmst...@gmail.com> wrote:
> 
> Hello,
> 
> I have a simple question: Does the findall() method of lxml return elements 
> in document order?
> 
> So far, I find empirically that it does, and I have not seen an exception to 
> this rule. But the documentation does not mention anything about the ordering 
> of the elements being returned. Does the implementation still guarantee, that 
> elements are returned in document order?
> 
> Thanks for your help,
> Eero
> _______________________________________________
> lxml - The Python XML Toolkit mailing list -- lxml@python.org
> To unsubscribe send an email to lxml-le...@python.org
> https://mail.python.org/mailman3/lists/lxml.python.org/
> Member address: j...@qdevelop.de

_______________________________________________
lxml - The Python XML Toolkit mailing list -- lxml@python.org
To unsubscribe send an email to lxml-le...@python.org
https://mail.python.org/mailman3/lists/lxml.python.org/
Member address: arch...@mail-archive.com

Reply via email to