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 <[email protected]> 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 -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/lxml.python.org/
> Member address: [email protected]

_______________________________________________
lxml - The Python XML Toolkit mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/lxml.python.org/
Member address: [email protected]

Reply via email to