[issue31648] Improve ElementPath
Serhiy Storchaka
report at bugs.python.org
Sat Sep 30 05:39:00 EDT 2017
Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:
I think the break in the loop for [.='text'] is not correct.
>>> from xml.etree import ElementTree as ET
>>> e = ET.XML('<root><a><b>text</b></a><a><b></b></a><a><b>text</b></a></root>')
>>> list(e.findall('.//a[b="text"]'))
[<Element 'a' at 0x7ffadb305d58>, <Element 'a' at 0x7ffadb305f58>]
>>> list(e.findall('.//a[.="text"]'))
[<Element 'a' at 0x7ffadb305d58>]
I expect that findall() finds all matched elements, not just the first one. Both above requests should return the same result.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31648>
_______________________________________
More information about the Python-bugs-list
mailing list