summaryrefslogtreecommitdiff
path: root/bs4/element.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2019-08-26 18:21:01 -0400
committerLeonard Richardson <leonardr@segfault.org>2019-08-26 18:21:01 -0400
commit344ee4494196eb41ee049761193cdad529ee59de (patch)
treeeb08e716f7da0ed1ed992ba381a094bb54640394 /bs4/element.py
parent4eb30d2e0ad28c7ecf0b14682d341d10cbf53c34 (diff)
Fixed the definition of the default XML namespace when using
lxml 4.4. Patch by Isaac Muse. [bug=1840141]
Diffstat (limited to 'bs4/element.py')
-rw-r--r--bs4/element.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/bs4/element.py b/bs4/element.py
index 24d504b..d6ed020 100644
--- a/bs4/element.py
+++ b/bs4/element.py
@@ -46,6 +46,11 @@ def _alias(attr):
class NamespacedAttribute(unicode):
def __new__(cls, prefix, name, namespace=None):
+ if not name:
+ # This is the default namespace. Its name "has no value"
+ # per https://www.w3.org/TR/xml-names/#defaulting
+ name = None
+
if name is None:
obj = unicode.__new__(cls, prefix)
elif prefix is None: