From 41917656bd468a30ae91a9cbec6dec4bd7b23772 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Wed, 22 Jan 2025 18:18:55 +0100 Subject: [PATCH] Improve check for missing namespaces --- drafthorse/models/document.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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") -- 2.47.3