summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2022-01-15 15:34:22 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2022-01-16 02:02:12 +0900
commit76c9b3c6055964b20bc0b0f79f6e37914f620ebc (patch)
tree9be5e41ca0551b2d4b665e5ae36fec8432288c50
parent0938c193ea6f56dbb930bfb323602bc4e2b7b9c6 (diff)
downloadsphinx-git-76c9b3c6055964b20bc0b0f79f6e37914f620ebc.tar.gz
Fix #9413: xml: Invalid XML was generated when cross referencing python objects
-rw-r--r--CHANGES1
-rw-r--r--sphinx/builders/xml.py3
2 files changed, 4 insertions, 0 deletions
diff --git a/CHANGES b/CHANGES
index a1bb6dc82..2fd0c8e9c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -75,6 +75,7 @@ Bugs fixed
* #10015: py domain: types under the "typing" module are not hyperlinked defined
at info-field-list
* #9390: texinfo: Do not emit labels inside footnotes
+* #9413: xml: Invalid XML was generated when cross referencing python objects
* #9979: Error level messages were displayed as warning messages
* #10057: Failed to scan documents if the project is placed onto the root
directory
diff --git a/sphinx/builders/xml.py b/sphinx/builders/xml.py
index fdef14259..c4e066089 100644
--- a/sphinx/builders/xml.py
+++ b/sphinx/builders/xml.py
@@ -71,6 +71,9 @@ class XMLBuilder(Builder):
# work around multiple string % tuple issues in docutils;
# replace tuples in attribute values with lists
doctree = doctree.deepcopy()
+ for domain in self.env.domains.values():
+ xmlns = "xmlns:" + domain.name
+ doctree[xmlns] = "https://www.sphinx-doc.org/" # type: ignore
for node in doctree.findall(nodes.Element):
for att, value in node.attributes.items():
if isinstance(value, tuple):