This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Minidom does not have to escape quote inside text segments
Type: enhancement Stage: patch review
Components: XML Versions: Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: dhilst, mitar, scoder, serhiy.storchaka, viplezer
Priority: normal Keywords: patch

Created on 2019-06-22 20:34 by mitar, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 14312 open mitar, 2019-06-22 21:09
Messages (8)
msg346296 - (view) Author: Mitar (mitar) * Date: 2019-06-22 20:34
I am using Minidom to pretty-print XML. But currently if there is a quote inside a text segment it escapes it to "

To my understanding this is unnecessary if all other symbols are escaped. This escaping makes it really ugly and defeats the purpose of me using Minidom for pretty-printing XML.
msg346310 - (view) Author: Daniel Hilst Selli (dhilst) Date: 2019-06-23 00:18
Wouldn't be better to support this as a parameter? Escaping is pretty useful in HTML contexts
msg346341 - (view) Author: Mitar (mitar) * Date: 2019-06-23 21:08
FYI, this is exactly how ElementTree.tostring does it. So this would make ElementTree.tostring behave the same as minidom.

@dhilst: I do not think a parameter is needed here. This is completely compatible with HTML. It is just that currently an additional unnecessary escaping (for both XML in HTML context) is done.
msg346350 - (view) Author: Daniel Hilst Selli (dhilst) Date: 2019-06-24 01:42
This changes behavior in an irreversible way. A parameter would make it reversible.
msg346892 - (view) Author: Mitar (mitar) * Date: 2019-06-29 17:59
Sure, but is old behavior useful in any use case? Every bugfix changes old behavior in an irreversible way.

So in which use case you want the old behavior? Can you elaborate here?
msg346894 - (view) Author: Daniel Hilst Selli (dhilst) Date: 2019-06-29 18:19
Not really, I don't have a use case here. I'm just warning that this would break user code that relies on old behavior.

Anyway is possible to add new behavior without changing the old one. A parameter would make this possible, for example.

This is only my opinion, let's other argue too
msg388423 - (view) Author: Viktor Plézer (viplezer) Date: 2021-03-10 10:50
Almost 2 years later I only registered to agree with Daniel. This is extremely annoying.

Use case: I am generating XMLs for Apigee, where my conditions contain quotes and there's no need to escape them.
msg388424 - (view) Author: Viktor Plézer (viplezer) Date: 2021-03-10 10:53
Sorry, to agree with @mitar
History
Date User Action Args
2022-04-11 14:59:17adminsetgithub: 81555
2021-03-10 10:53:53viplezersetmessages: + msg388424
2021-03-10 10:50:28viplezersetnosy: + viplezer
messages: + msg388423
2019-06-29 18:19:08dhilstsetmessages: + msg346894
2019-06-29 17:59:19mitarsetmessages: + msg346892
2019-06-24 01:42:18dhilstsetmessages: + msg346350
2019-06-23 21:08:19mitarsetmessages: + msg346341
2019-06-23 00:18:20dhilstsetnosy: + dhilst
messages: + msg346310
2019-06-22 23:26:53xtreaksetnosy: + scoder, serhiy.storchaka
2019-06-22 21:09:33mitarsetkeywords: + patch
stage: patch review
pull_requests: + pull_request14134
2019-06-22 20:34:20mitarcreate