mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
Issue #2746: Don't escape ampersands and angle brackets ("&", "<", ">")
in XML processing instructions and comments. These raw characters are allowed by the XML specification, and are necessary when outputting e.g. PHP code in a processing instruction. Patch by Neil Muller.
This commit is contained in:
parent
7b5aa463f9
commit
42fb6ab491
4 changed files with 25 additions and 2 deletions
|
|
@ -213,6 +213,23 @@ def check_encoding(ET, encoding):
|
|||
"""
|
||||
ET.XML("<?xml version='1.0' encoding='%s'?><xml />" % encoding)
|
||||
|
||||
def processinginstruction():
|
||||
"""
|
||||
Test ProcessingInstruction directly
|
||||
|
||||
>>> from xml.etree import ElementTree as ET
|
||||
|
||||
>>> ET.tostring(ET.ProcessingInstruction('test', 'instruction'))
|
||||
'<?test instruction?>'
|
||||
>>> ET.tostring(ET.PI('test', 'instruction'))
|
||||
'<?test instruction?>'
|
||||
|
||||
Issue #2746
|
||||
|
||||
>>> ET.tostring(ET.PI('test', '<testing&>'))
|
||||
'<?test <testing&>?>'
|
||||
|
||||
"""
|
||||
|
||||
#
|
||||
# xinclude tests (samples from appendix C of the xinclude specification)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue