From 344ee4494196eb41ee049761193cdad529ee59de Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Mon, 26 Aug 2019 18:21:01 -0400 Subject: Fixed the definition of the default XML namespace when using lxml 4.4. Patch by Isaac Muse. [bug=1840141] --- bs4/element.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'bs4/element.py') 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: -- cgit v1.2.3