Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ba8a9860
Commit
ba8a9860
authored
Aug 08, 2010
by
Florent Xicluna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix xml.etree.ElementInclude to include the tail of the current node. Issue #6231
parent
14bd1c3b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
Lib/test/test_xml_etree.py
Lib/test/test_xml_etree.py
+18
-0
Lib/xml/etree/ElementInclude.py
Lib/xml/etree/ElementInclude.py
+1
-1
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_xml_etree.py
View file @
ba8a9860
...
...
@@ -1277,6 +1277,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">
...
...
@@ -1352,6 +1360,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")
...
...
Lib/xml/etree/ElementInclude.py
View file @
ba8a9860
...
...
@@ -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
]
...
...
Misc/NEWS
View file @
ba8a9860
...
...
@@ -63,6 +63,9 @@ Extensions
Library
-------
- Issue #6231: Fix xml.etree.ElementInclude to include the tail of the
current node.
- Issue #8047: Fix the xml.etree serializer to return bytes by default. Use
``encoding="unicode"`` to generate a Unicode string.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment