Issue 6655: etree iterative find[text] (original) (raw)

Issue6655

Created on 2009-08-06 03:35 by Digitalxero, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ElementTree.py.patch Digitalxero,2009-08-06 03:35 ElementTree.py patch file to include iter_find and iter_findtext
ElementPath.py.patch Digitalxero,2009-08-06 03:36 ElementPath.py patch file to include iter_find and iter_findtext
Messages (4)
msg91348 - (view) Author: Dj Gilcrease (Digitalxero) Date: 2009-08-06 03:35
I recently converted a project from using a custom implementation of xml.dom.minidom to using EelemntTree that comes with python2.5+ and found myself wishing for a find(tag_or_path) method that would do so iteratively instead of just on the current elements direct children. This is possible with the code as written; looking_for = None for el in etree.getiterator(tag_or_path): looking_for = el break I have to do this type of action so often in my code that I just decided to grab the python implementation of etree that came with py2.6 and include it with my app and patch in an iter_find method as the instant break for loop is just asking for maintenance issues down the road what I forget why I was breaking on the first loop no matter what.
msg91349 - (view) Author: Dj Gilcrease (Digitalxero) Date: 2009-08-06 03:36
second patch file
msg111544 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-25 13:09
@Digitalxero: could you provide an updated unit test file please.
msg146591 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2011-10-29 02:14
ElementTree 1.3 added the "iterfind" method to Python 2.7 and 3.2. http://docs.python.org/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.iterfind
History
Date User Action Args
2022-04-11 14:56:51 admin set github: 50904
2011-10-29 02:14:39 flox set status: open -> closedresolution: out of datemessages: + stage: test needed -> resolved
2010-07-25 13:09:51 BreamoreBoy set versions: - Python 2.7nosy: + BreamoreBoymessages: + stage: test needed
2010-02-16 13:24:08 flox set priority: normalnosy: + flox
2009-08-06 03:36:13 Digitalxero set files: + ElementPath.py.patchmessages: +
2009-08-06 03:35:18 Digitalxero create