From 2f1b1ffb1d4bb73f6269e95d50cea04eb206d417 Mon Sep 17 00:00:00 2001
From: Florent Xicluna
Date: Mon, 9 Aug 2010 20:46:49 +0000
Subject: [PATCH] Merged revisions 83864 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
........
r83864 | florent.xicluna | 2010-08-09 01:08:41 +0200 (lun., 09 août 2010) | 2 lines
Fix xml.etree.ElementInclude to include the tail of the current node. Issue #6231
........
---
Lib/test/test_xml_etree.py | 18 ++++++++++++++++++
Lib/xml/etree/ElementInclude.py | 2 +-
Misc/NEWS | 3 +++
3 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
index ad3f112f8a..98ca4d2880 100644
--- a/Lib/test/test_xml_etree.py
+++ b/Lib/test/test_xml_etree.py
@@ -1259,6 +1259,14 @@ XINCLUDE["C2.xml"] = """\
XINCLUDE["count.txt"] = "324387"
+XINCLUDE["C2b.xml"] = """\
+
+
+ This document has been accessed
+ times.
+
+"""
+
XINCLUDE["C3.xml"] = """\
@@ -1334,6 +1342,16 @@ def xinclude():
324387 times.
+ Textual inclusion after sibling element (based on modified XInclude C.2)
+
+ >>> document = xinclude_loader("C2b.xml")
+ >>> ElementInclude.include(document, xinclude_loader)
+ >>> print(serialize(document)) # C2b
+
+ This document has been accessed
+ 324387 times.
+
+
Textual inclusion of XML example (XInclude C.3)
>>> document = xinclude_loader("C3.xml")
diff --git a/Lib/xml/etree/ElementInclude.py b/Lib/xml/etree/ElementInclude.py
index dde0a41531..84fd7548b2 100644
--- a/Lib/xml/etree/ElementInclude.py
+++ b/Lib/xml/etree/ElementInclude.py
@@ -125,7 +125,7 @@ def include(elem, loader=None):
)
if i:
node = elem[i-1]
- node.tail = (node.tail or "") + text
+ node.tail = (node.tail or "") + text + (e.tail or "")
else:
elem.text = (elem.text or "") + text + (e.tail or "")
del elem[i]
diff --git a/Misc/NEWS b/Misc/NEWS
index bf86216def..0f54b9317a 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -29,6 +29,9 @@ Core and Builtins
Library
-------
+- Issue #6231: Fix xml.etree.ElementInclude to include the tail of the
+ current node.
+
- Issue #6869: Fix a refcount problem in the _ctypes extension.
- Issue5504 - ctypes should now work with systems where mmap can't be
--
2.40.0