[issue30485] Element.findall(path, dict) doesn't insert null namespace

Ben Wainwright report at bugs.python.org
Fri May 26 08:57:08 EDT 2017


New submission from Ben Wainwright:

The findall method for ElementTree.Element handles namespace prefixes by tokenising the path and inserting the full namespace in braces based on entries in a dictionary.

Unfortunately, this does not work for a namespace without a prefix, so if you have files containing namespaces with and without prefixes, you still need to manually add the namespace url for the unprefixed path.

The function xpath_tokenizer checks to see if tokens contain a colon and only adds in the namespace url in that instance.

This could be changed to add the url if their is a colon, or if there is not, and the empty string key is present in the namespaces dictionary.

----------
components: Library (Lib), XML
messages: 294549
nosy: ben.wainwright
priority: normal
severity: normal
status: open
title: Element.findall(path, dict) doesn't insert null namespace
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30485>
_______________________________________


More information about the Python-bugs-list mailing list