How can I generate XML with CR, instead of CRLF in XmlTextWriter

后端 未结 4 1480
故里飘歌
故里飘歌 2021-01-19 17:57

I\'m generating XML via XmlTextWriter.

The file looks good to my eyes, validates (at wc3), and was accepted by the client.

But a client vendor is complainin

4条回答
  •  臣服心动
    2021-01-19 18:54

    What line ending is used should not matter to a properly implemented parser (see the spec), I quote (emphasis mine):

    To simplify the tasks of applications, the XML processor 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.

    Therefore, you should be fine with the way you have it right now. You might want to ask what the client vendor is actually doing there, chances are that they are Doing it Wrong.

提交回复
热议问题