From f1fbb98fdeebeb5accfd9520b4808c3b792b7dca Mon Sep 17 00:00:00 2001 From: Arjun Nemani Date: Wed, 7 Jul 2021 12:39:01 +0100 Subject: [PATCH] #9413 Declare py namespace on document root to generate valid xml --- sphinx/builders/xml.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sphinx/builders/xml.py b/sphinx/builders/xml.py index 865820c364c..853eed6dce6 100644 --- a/sphinx/builders/xml.py +++ b/sphinx/builders/xml.py @@ -71,6 +71,7 @@ def write_doc(self, docname: str, doctree: Node) -> None: # work around multiple string % tuple issues in docutils; # replace tuples in attribute values with lists doctree = doctree.deepcopy() + doctree.document.attributes["xmlns:py"] = "https://github.com/sphinx-doc/sphinx/issues/9413" for node in doctree.traverse(nodes.Element): for att, value in node.attributes.items(): if isinstance(value, tuple):