This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author scoder
Recipients eli.bendersky, py.user, scoder, serhiy.storchaka
Date 2019-04-15.18:51:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
lxml has a couple of nice features here:

- all tags in a namespace: "{namespace}*"
- a local name 'tag' in any (or no) namespace: "{*}tag"
- a tag without namespace: "{}tag"
- all tags without namespace: "{}*"

"{*}*" is also accepted but is the same as "*". Note that "*" is actually allowed as an XML tag name by the spec, but rare enough to hijack it for this purpose. I've actually never seen it used anywhere in the wild.

lxml's implementation isn't applicable to ElementTree (searching has been subject to excessive optimisation), but it shouldn't be hard to extend the one in ET's module, as well as Element.iter() in, to support this kind of tag comparison.

PR welcome.

lxml's tests are here (and in the following test methods):

Note that they actually test the deprecated .getiterator() method for historical reasons. They should probably call .iter() instead these days. lxml's ElementPath implementation is under src/lxml/, but the tag comparison itself is done elsewhere in Cython code (here, in case it matters:)
Date User Action Args
2019-04-15 18:51:42scodersetrecipients: + scoder, eli.bendersky, py.user, serhiy.storchaka
2019-04-15 18:51:42scodersetmessageid: <>
2019-04-15 18:51:42scoderlinkissue28238 messages
2019-04-15 18:51:42scodercreate