diff options
author | Leonard Richardson <leonardr@segfault.org> | 2019-08-26 18:21:01 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2019-08-26 18:21:01 -0400 |
commit | 344ee4494196eb41ee049761193cdad529ee59de (patch) | |
tree | eb08e716f7da0ed1ed992ba381a094bb54640394 | |
parent | 4eb30d2e0ad28c7ecf0b14682d341d10cbf53c34 (diff) |
Fixed the definition of the default XML namespace when using
lxml 4.4. Patch by Isaac Muse. [bug=1840141]
-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: |