diff options
-rw-r--r-- | CHANGELOG | 3 | ||||
-rw-r--r-- | bs4/element.py | 5 |
2 files changed, 8 insertions, 0 deletions
@@ -6,6 +6,9 @@ and position within a line (Tag.sourcepos). Based on code by Chris Mayo. [bug=1742921] +* Fixed the definition of the default XML namespace when using + lxml 4.4. Patch by Isaac Muse. [bug=1840141] + * Fixed a crash when pretty-printing tags that were not created during initial parsing. [bug=1838903] 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: |