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

Created on 2019-06-22 20:34 by mitar, last changed 2019-06-29 18:19 by dhilst.

Pull Requests
URL Status Linked Edit
PR 14312 open mitar, 2019-06-22 21:09
Messages (6)
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
Date User Action Args
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