[Mono-dev] Behavior change in XmlWriterSettings/XmlTextWriter
Oskar Berggren
oskar.berggren at gmail.com
Tue Sep 29 15:50:11 UTC 2015
Perhaps the documentation is not so much platform specific, as just being
sloppily written in this case, in the case that it appears to state what
happens to be the default value (on Windows) without saying that it is
indeed grabbed from a platform specific default.
XML is normally often presented as a text file so at least I would expect
it to follow platform conventions for new lines. If the generated XML is to
be sent over some protocol that prescribes a particular new line
conventions, then it is of course the writers responsibility to specify the
intended new line characters.
Also note the XML spec,
http://www.w3.org/TR/2008/REC-xml-20081126/#sec-line-ends:
"To simplify the tasks of applications
<http://www.w3.org/TR/2008/REC-xml-20081126/#dt-app>, the XML processor
<http://www.w3.org/TR/2008/REC-xml-20081126/#dt-xml-proc> *MUST* behave as
if it normalized all line breaks in external parsed entities (including the
document entity) on input, before parsing, by translating both the
two-character sequence #xD #xA and any #xD that is not followed by #xA to a
single #xA character."
Regards,
Oskar
2015-09-28 18:15 GMT+01:00 Martin Potter <Martin.Potter at faithlife.com>:
> I wasn’t aware that the MSDN .NET documentation was viewed as being
> platform specific documentation.
>
> I am not sure how this is a Microsoft bug so much as an issue with the
> fact they did not consider it being run on other platforms. Given that
> Mono is cross-platform, whereas Microsoft’s implementation is not, and
> Mono has made other changes to the reference source (which is very Windows
> specific) to provide consistency across platforms it is unclear as to why
> the previous behavior of using \r\n (prior to the switch to the reference
> source) is incorrect.
>
> ― Martin
>
> On 9/28/15, 9:58 AM, "Atsushi Eno" <atsushieno at veritas-vos-liberabit.com>
> wrote:
>
> >MSDN documentation describes the behavior how .NET Framework works on
> >Windows, hence it says \r\n. As the referencesource is explicitly
> >implemented, it is NOT the case on non-Windows platform.
> >
> >If you are unhappy about Microsoft behavior, you should file a bug to
> >Microsoft. referencesource is not for reporting issues though (as its
> >README explicitly says so).
> >
> >Atsushi Eno
> >
> >On 2015年09月28日 23:15, Martin Potter wrote:
> >> The default for XamlWriterSettings NewLineChars was changed from "\r\n"
> >>to
> >> "\n" when you imported the reference source and is what is present on
> >>the
> >> 4.2 branch. This is not what the previous behavior was, nor what the
> >> documentation on MSDN,
> >>
> >>
> https://msdn.microsoft.com/en-us/library/system.xml.xmlwritersettings.new
> >>li
> >> nechars(v=vs.110).aspx, states.
> >>
> >> "The character string to use for line breaks. This can be set to any
> >> string value. However, to ensure valid XML, you should specify only
> >>valid
> >> white space characters, such as space characters, tabs, carriage
> >>returns,
> >> or line feeds. The default is \r\n (carriage return, new line)."
> >>
> >> ― Martin
> >>
> >> On 9/28/15, 8:08 AM, "Atsushi Eno"
> >><atsushieno at veritas-vos-liberabit.com>
> >> wrote:
> >>
> >>> Current Microsoft-based implementation is the correct one and it's been
> >>> there in post-4.0 versions.
> >>>
> >>> Atsushi Eno
> >>>
> >>> On 2015年09月28日 22:46, Martin Potter wrote:
> >>>> Atsushi,
> >>>>
> >>>> Were you (or someone else) going to get this fixed before 4.2 is ready
> >>>> to
> >>>> ship?
> >>>>
> >>>> Thank you,
> >>>> Martin
> >>>>
> >>>> On 9/8/15, 8:03 PM, "Atsushi Eno"
> >>>><atsushieno at veritas-vos-liberabit.com>
> >>>> wrote:
> >>>>
> >>>>> I had no idea when that commit was made, but that change was wrong.
> >>>>> Microsoft behavior is the one we should use in that case.
> >>>>>
> >>>>> Atsushi Eno
> >>>>>
> >>>>> On 2015年09月09日 01:50, Martin Potter wrote:
> >>>>>> Way back in 2012, this commit
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> https://github.com/mono/mono/commit/9215ddf7ade5f0f0f54c2adb7b165e4e3
> >>>>>>e7
> >>>>>> 74
> >>>>>> 33b
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>><
> https://github.com/LogosBible/mono/commit/9215ddf7ade5f0f0f54c2adb7b
> >>>>>>16
> >>>>>> 5e
> >>>>>> 4e3e77433b> changed
> >>>>>> the default newline in XmlWriterSettings to be "\r\n” to be
> >>>>>>compatible
> >>>>>> with MS (which some of our tests rely on). It appears that when the
> >>>>>> reference source was imported in
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> https://github.com/mono/mono/commit/4990b4c47b8fe1b219c64884fad98d586
> >>>>>>15
> >>>>>> 46
> >>>>>> a05#diff-5561e6ab8de20ec168dcb1f7b415b353,
> >>>>>> it was changed back to be platform specific. Was this an intentional
> >>>>>> change?
> >>>>>>
> >>>>>> Thank you,
> >>>>>> Martin
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> _______________________________________________
> >>>>>> Mono-devel-list mailing list
> >>>>>> Mono-devel-list at lists.ximian.com
> >>>>>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> >>>>>>
> >>>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>
> >>
> >>
> >
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20150929/80422f02/attachment.html>
More information about the Mono-devel-list
mailing list