diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-08-09 20:46:49 (GMT) |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-08-09 20:46:49 (GMT) |
commit | 2f1b1ffb1d4bb73f6269e95d50cea04eb206d417 (patch) | |
tree | 462992ed1c3eb5645a9948f3511efff0aa659830 /Lib | |
parent | 0fad1c2272ed68d877c89b10da5265cf403cf189 (diff) | |
download | cpython-2f1b1ffb1d4bb73f6269e95d50cea04eb206d417.zip cpython-2f1b1ffb1d4bb73f6269e95d50cea04eb206d417.tar.gz cpython-2f1b1ffb1d4bb73f6269e95d50cea04eb206d417.tar.bz2 |
Merged revisions 83864 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
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
........
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_xml_etree.py | 18 | ||||
-rw-r--r-- | Lib/xml/etree/ElementInclude.py | 2 |
2 files changed, 19 insertions, 1 deletions
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py index ad3f112..98ca4d2 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"] = """\ +<?xml version='1.0'?> +<document xmlns:xi="http://www.w3.org/2001/XInclude"> + <p>This document has been <em>accessed</em> + <xi:include href="count.txt" parse="text"/> times.</p> +</document> +""" + XINCLUDE["C3.xml"] = """\ <?xml version='1.0'?> <document xmlns:xi="http://www.w3.org/2001/XInclude"> @@ -1334,6 +1342,16 @@ def xinclude(): 324387 times.</p> </document> + 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 + <document> + <p>This document has been <em>accessed</em> + 324387 times.</p> + </document> + 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 dde0a41..84fd754 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] |