[issue39011] ElementTree attributes replace "\r" with "\n"

mefistotelis report at bugs.python.org
Tue Dec 10 15:04:34 EST 2019


mefistotelis <mefistotelis at gmail.com> added the comment:

Disclaimer: I'm not at all an expert in XML specs.

The linked spec chapter, "End-of-Line Handling", says all line endings should behave like they were converted to "\n" _before_ parsing.

This means:

1. This part of spec does not apply to the behavior described in the issue , because line endings are converted before the file is saved. The spec describes loading process, not saving.

2. Before parsing, the line endings within attributes are replaced by idioms - so they are no longer line endings in the meaning assigned by the spec. The chapter starts with clear indication that it only applies to line endings which are used to give structure to physical file. The affected line endings are narrowed by stating: "files [...], for editing convenience, are organized into lines.". Since line endings in attributes are idiomized, they don't take part of organizing file into lines.


Then again, I'm not an expert. From the various specs I worked with, I know that the affected industry always comes out with unified interpretation of specs. If it was widely accepted to apply this chapter to values of attributes, I'd understand.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39011>
_______________________________________


More information about the Python-bugs-list mailing list