From: Raphael Michel Date: Wed, 22 Jan 2025 17:18:55 +0000 (+0100) Subject: Improve check for missing namespaces X-Git-Tag: 2025.1.1~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=41917656bd468a30ae91a9cbec6dec4bd7b23772;p=thirdparty%2Fpython-drafthorse.git Improve check for missing namespaces --- diff --git a/drafthorse/models/document.py b/drafthorse/models/document.py index bbdcc11..b654f92 100644 --- a/drafthorse/models/document.py +++ b/drafthorse/models/document.py @@ -121,7 +121,7 @@ class Document(Element): # Second pass to ensure all namespaces are defined even if they are unused root = ET.fromstring(xml) for ns, url in self.__namespaces.items(): - if ns.encode() not in xml: + if f"xmlns:{ns}".encode() not in xml: root.set(f"xmlns:{ns}", url) return ET.tostring(root, "utf-8")