Skip to content

Commit d379d54

Browse files
authored
Document correct NewLineChars default values (dotnet#8587)
* Document correct NewLineChars default values Fixes dotnet#8315 * Updating wording due to PR comments
1 parent dbf73b7 commit d379d54

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

xml/System.Xml/XmlWriter.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
|<xref:System.Xml.XmlWriterSettings.Encoding%2A>|Specifies the text encoding to use. The default is `Encoding.UTF8`.|
105105
|<xref:System.Xml.XmlWriterSettings.Indent%2A>|Indicates whether to indent elements. The default is `false` (no indentation).|
106106
|<xref:System.Xml.XmlWriterSettings.IndentChars%2A>|Specifies the character string to use when indenting. The default is two spaces.|
107-
|<xref:System.Xml.XmlWriterSettings.NewLineChars%2A>|Specifies the character string to use for line breaks. The default is `\r\n` (carriage return, line feed).|
107+
|<xref:System.Xml.XmlWriterSettings.NewLineChars%2A>|Specifies the character string to use for line breaks. The default is `\r\n` (carriage return, line feed) for non-Unix platforms, and `\n` (line feed) for Unix platforms.|
108108
|<xref:System.Xml.XmlWriterSettings.NewLineHandling%2A>|Specifies how to handle newline characters.|
109109
|<xref:System.Xml.XmlWriterSettings.NewLineOnAttributes%2A>|Indicates whether to write attributes on a new line. <xref:System.Xml.XmlWriterSettings.Indent%2A> should be set to `true` when using this property. The default is `false`.|
110110
|<xref:System.Xml.XmlWriterSettings.OmitXmlDeclaration%2A>|Indicates whether to write an XML declaration. The default is `false`.|
@@ -378,7 +378,7 @@ An <see cref="T:System.Xml.XmlWriter" /> method was called before a previous asy
378378
|<xref:System.Xml.XmlWriterSettings.Indent%2A>|`false`|
379379
|<xref:System.Xml.XmlWriterSettings.IndentChars%2A>|Two spaces|
380380
|<xref:System.Xml.XmlWriterSettings.NamespaceHandling%2A>|<xref:System.Xml.NamespaceHandling.Default> (no removal)|
381-
|<xref:System.Xml.XmlWriterSettings.NewLineChars%2A>|`\r\n` (carriage return, new line)|
381+
|<xref:System.Xml.XmlWriterSettings.NewLineChars%2A>|`\r\n` (carriage return, line feed) for non-Unix platforms, or `\n` (line feed) for Unix platforms|
382382
|<xref:System.Xml.XmlWriterSettings.NewLineHandling%2A>|<xref:System.Xml.NewLineHandling.Replace?displayProperty=nameWithType>|
383383
|<xref:System.Xml.XmlWriterSettings.NewLineOnAttributes%2A>|`false`|
384384
|<xref:System.Xml.XmlWriterSettings.OmitXmlDeclaration%2A>|`false`|
@@ -454,7 +454,7 @@ An <see cref="T:System.Xml.XmlWriter" /> method was called before a previous asy
454454
|<xref:System.Xml.XmlWriterSettings.Indent%2A>|`false`|
455455
|<xref:System.Xml.XmlWriterSettings.IndentChars%2A>|Two spaces|
456456
|<xref:System.Xml.XmlWriterSettings.NamespaceHandling%2A>|<xref:System.Xml.NamespaceHandling.Default> (no removal)|
457-
|<xref:System.Xml.XmlWriterSettings.NewLineChars%2A>|`\r\n` (carriage return, new line)|
457+
|<xref:System.Xml.XmlWriterSettings.NewLineChars%2A>|`\r\n` (carriage return, line feed) for non-Unix platforms, or `\n` (line feed) for Unix platforms|
458458
|<xref:System.Xml.XmlWriterSettings.NewLineHandling%2A>|<xref:System.Xml.NewLineHandling.Replace?displayProperty=nameWithType>|
459459
|<xref:System.Xml.XmlWriterSettings.NewLineOnAttributes%2A>|`false`|
460460
|<xref:System.Xml.XmlWriterSettings.OmitXmlDeclaration%2A>|`false`|
@@ -540,7 +540,7 @@ An <see cref="T:System.Xml.XmlWriter" /> method was called before a previous asy
540540
|<xref:System.Xml.XmlWriterSettings.Indent%2A>|`false`|
541541
|<xref:System.Xml.XmlWriterSettings.IndentChars%2A>|Two spaces|
542542
|<xref:System.Xml.XmlWriterSettings.NamespaceHandling%2A>|<xref:System.Xml.NamespaceHandling.Default> (no removal)|
543-
|<xref:System.Xml.XmlWriterSettings.NewLineChars%2A>|`\r\n` (carriage return, new line)|
543+
|<xref:System.Xml.XmlWriterSettings.NewLineChars%2A>|`\r\n` (carriage return, line feed) for non-Unix platforms, or `\n` (line feed) for Unix platforms|
544544
|<xref:System.Xml.XmlWriterSettings.NewLineHandling%2A>|<xref:System.Xml.NewLineHandling.Replace?displayProperty=nameWithType>|
545545
|<xref:System.Xml.XmlWriterSettings.NewLineOnAttributes%2A>|`false`|
546546
|<xref:System.Xml.XmlWriterSettings.OmitXmlDeclaration%2A>|`false`|
@@ -621,7 +621,7 @@ An <see cref="T:System.Xml.XmlWriter" /> method was called before a previous asy
621621
|<xref:System.Xml.XmlWriterSettings.Indent%2A>|`false`|
622622
|<xref:System.Xml.XmlWriterSettings.IndentChars%2A>|Two spaces|
623623
|<xref:System.Xml.XmlWriterSettings.NamespaceHandling%2A>|<xref:System.Xml.NamespaceHandling.Default> (no removal)|
624-
|<xref:System.Xml.XmlWriterSettings.NewLineChars%2A>|`\r\n` (carriage return, new line)|
624+
|<xref:System.Xml.XmlWriterSettings.NewLineChars%2A>|`\r\n` (carriage return, line feed) for non-Unix platforms, or `\n` (line feed) for Unix platforms|
625625
|<xref:System.Xml.XmlWriterSettings.NewLineHandling%2A>|<xref:System.Xml.NewLineHandling.Replace?displayProperty=nameWithType>|
626626
|<xref:System.Xml.XmlWriterSettings.NewLineOnAttributes%2A>|`false`|
627627
|<xref:System.Xml.XmlWriterSettings.OmitXmlDeclaration%2A>|`false`|
@@ -705,7 +705,7 @@ An <see cref="T:System.Xml.XmlWriter" /> method was called before a previous asy
705705
|<xref:System.Xml.XmlWriterSettings.Indent%2A>|`false`|
706706
|<xref:System.Xml.XmlWriterSettings.IndentChars%2A>|Two spaces|
707707
|<xref:System.Xml.XmlWriterSettings.NamespaceHandling%2A>|<xref:System.Xml.NamespaceHandling.Default> (no removal)|
708-
|<xref:System.Xml.XmlWriterSettings.NewLineChars%2A>|`\r\n` (carriage return, new line)|
708+
|<xref:System.Xml.XmlWriterSettings.NewLineChars%2A>|`\r\n` (carriage return, line feed) for non-Unix platforms, or `\n` (line feed) for Unix platforms|
709709
|<xref:System.Xml.XmlWriterSettings.NewLineHandling%2A>|<xref:System.Xml.NewLineHandling.Replace?displayProperty=nameWithType>|
710710
|<xref:System.Xml.XmlWriterSettings.NewLineOnAttributes%2A>|`false`|
711711
|<xref:System.Xml.XmlWriterSettings.OmitXmlDeclaration%2A>|`false`|
@@ -783,7 +783,7 @@ An <see cref="T:System.Xml.XmlWriter" /> method was called before a previous asy
783783
|<xref:System.Xml.XmlWriterSettings.Indent%2A>|`false`|
784784
|<xref:System.Xml.XmlWriterSettings.IndentChars%2A>|Two spaces|
785785
|<xref:System.Xml.XmlWriterSettings.NamespaceHandling%2A>|<xref:System.Xml.NamespaceHandling.Default> (no removal)|
786-
|<xref:System.Xml.XmlWriterSettings.NewLineChars%2A>|`\r\n` (carriage return, new line)|
786+
|<xref:System.Xml.XmlWriterSettings.NewLineChars%2A>|`\r\n` (carriage return, line feed) for non-Unix platforms, or `\n` (line feed) for Unix platforms|
787787
|<xref:System.Xml.XmlWriterSettings.NewLineHandling%2A>|<xref:System.Xml.NewLineHandling.Replace?displayProperty=nameWithType>|
788788
|<xref:System.Xml.XmlWriterSettings.NewLineOnAttributes%2A>|`false`|
789789
|<xref:System.Xml.XmlWriterSettings.OmitXmlDeclaration%2A>|`false`|

xml/System.Xml/XmlWriterSettings.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
|<xref:System.Xml.XmlWriterSettings.Encoding%2A>|Text encoding to use.|<xref:System.Text.Encoding?displayProperty=nameWithType> value|<xref:System.Text.Encoding.UTF8?displayProperty=nameWithType>|
6767
|<xref:System.Xml.XmlWriterSettings.Indent%2A>|Whether to indent elements|`true` or `false`|`false` (no indentation)|
6868
|<xref:System.Xml.XmlWriterSettings.IndentChars%2A>|Character string to use when indenting (used when <xref:System.Xml.XmlWriterSettings.Indent%2A> is set to `true`).|String|Two spaces|
69-
|<xref:System.Xml.XmlWriterSettings.NewLineChars%2A>|Character string to use for line breaks.|String|`\r\n` (carriage return, line feed)|
69+
|<xref:System.Xml.XmlWriterSettings.NewLineChars%2A>|Character string to use for line breaks.|String|`\r\n` (carriage return, line feed) for non-Unix platforms, or `\n` (line feed) for Unix platforms|
7070
|<xref:System.Xml.XmlWriterSettings.NewLineHandling%2A>|How to handle newline characters.|<xref:System.Xml.NewLineHandling?displayProperty=nameWithType> value: <xref:System.Xml.NewLineHandling.Entitize> (normalize), <xref:System.Xml.NewLineHandling.Replace> (replace), or <xref:System.Xml.NewLineHandling.None> (leave unchanged)|<xref:System.Xml.NewLineHandling.Replace> (replace with characters specified by <xref:System.Xml.XmlWriterSettings.NewLineChars%2A>)|
7171
|<xref:System.Xml.XmlWriterSettings.NewLineOnAttributes%2A>|Whether to write attributes on individual lines (has no effect when <xref:System.Xml.XmlWriterSettings.Indent%2A> is `false`).|`true` or `false`|`false`|
7272
|<xref:System.Xml.XmlWriterSettings.OmitXmlDeclaration%2A>|Whether to write an XML declaration.|`true` or `false`|`false`|
@@ -141,7 +141,7 @@
141141
|<xref:System.Xml.XmlWriterSettings.Encoding%2A>|`Encoding.UTF8`.|
142142
|<xref:System.Xml.XmlWriterSettings.Indent%2A>|`false`.|
143143
|<xref:System.Xml.XmlWriterSettings.IndentChars%2A>|Two spaces.|
144-
|<xref:System.Xml.XmlWriterSettings.NewLineChars%2A>|`\r\n` (carriage return, new line).|
144+
|<xref:System.Xml.XmlWriterSettings.NewLineChars%2A>|`\r\n` (carriage return, line feed) for non-Unix platforms, or `\n` (line feed) for Unix platforms.|
145145
|<xref:System.Xml.XmlWriterSettings.NewLineHandling%2A>|<xref:System.Xml.NewLineHandling.Replace>.|
146146
|<xref:System.Xml.XmlWriterSettings.NewLineOnAttributes%2A>|`false`.|
147147
|<xref:System.Xml.XmlWriterSettings.OmitXmlDeclaration%2A>|`false`.|
@@ -808,7 +808,7 @@ using (StreamWriter output =
808808
</ReturnValue>
809809
<Docs>
810810
<summary>Gets or sets the character string to use for line breaks.</summary>
811-
<value>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 <c>\r\n</c> (carriage return, new line).</value>
811+
<value>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 <c>\r\n</c> (carriage return, new line) for non-Unix platforms, and <c>\n</c> (new line) for Unix platforms.</value>
812812
<remarks>
813813
<format type="text/markdown"><![CDATA[
814814
@@ -871,7 +871,7 @@ using (StreamWriter output =
871871
872872
- The <xref:System.Xml.NewLineHandling.Entitize> setting tells the <xref:System.Xml.XmlWriter> to replace new line characters that would not be otherwise preserved by a normalizing <xref:System.Xml.XmlReader> with character entities. This is useful in round-trip scenarios where the output is read by a normalizing <xref:System.Xml.XmlReader>. Additional normalization rules apply for attribute values when round tripping since `\t`, `\n` and `\r` are replaced with a space in attribute values when normalized in an <xref:System.Xml.XmlReader>.
873873
874-
- The <xref:System.Xml.NewLineHandling.Replace> setting tells the <xref:System.Xml.XmlWriter> to replace new line characters with `\r\n`, which is the new line format used by the Microsoft Windows operating system. This helps to ensure that the file can be correctly displayed by the Notepad or Microsoft Word applications. This setting also replaces new lines in attributes with character entities to preserve the characters. This is the default value.
874+
- The <xref:System.Xml.NewLineHandling.Replace> setting tells the <xref:System.Xml.XmlWriter> to replace new line characters with the character(s) specificed in the <xref:System.Xml.XmlWriterSettings.NewLineChars%2A> property. This setting also replaces new lines in attributes with character entities to preserve the characters. It is also the default value.
875875
876876
- The <xref:System.Xml.NewLineHandling.None> setting tells the <xref:System.Xml.XmlWriter> to leave the input unchanged. This setting is used when you do not want any new-line processing. This is useful when the output is read by an <xref:System.Xml.XmlReader> that does not do any normalization (for example, an <xref:System.Xml.XmlTextReader> with default settings.)
877877
@@ -1159,7 +1159,7 @@ This setting has no effect when the <xref:System.Xml.XmlWriterSettings.Indent> p
11591159
|<xref:System.Xml.XmlWriterSettings.Encoding%2A>|`Encoding.UTF8`.|
11601160
|<xref:System.Xml.XmlWriterSettings.Indent%2A>|`false`.|
11611161
|<xref:System.Xml.XmlWriterSettings.IndentChars%2A>|Two spaces.|
1162-
|<xref:System.Xml.XmlWriterSettings.NewLineChars%2A>|`\r\n`.|
1162+
|<xref:System.Xml.XmlWriterSettings.NewLineChars%2A>|`\r\n` (carriage return, line feed) for non-Unix platforms, or `\n` (line feed) for Unix platforms.|
11631163
|<xref:System.Xml.XmlWriterSettings.NewLineHandling%2A>|<xref:System.Xml.NewLineHandling.Replace>.|
11641164
|<xref:System.Xml.XmlWriterSettings.NewLineOnAttributes%2A>|`false`.|
11651165
|<xref:System.Xml.XmlWriterSettings.OmitXmlDeclaration%2A>|`false`.|

0 commit comments

Comments
 (0)