2 // XmlWriterSettings.cs
5 // Atsushi Enomoto <atsushi@ximian.com>
7 // (C) 2004 Novell Inc.
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36 using System
.Xml
.Schema
;
40 public class XmlWriterSettings
42 private bool checkCharacters
;
43 private bool closeOutput
;
44 private ConformanceLevel conformance
;
45 private Encoding encoding
;
47 private string indentChars
;
48 private string newLineChars
;
49 private bool newLineOnAttributes
;
50 private bool normalizeNewLines
;
51 private bool omitXmlDeclaration
;
53 public XmlWriterSettings ()
58 private XmlWriterSettings (XmlWriterSettings org
)
60 checkCharacters
= org
.checkCharacters
;
61 closeOutput
= org
.closeOutput
;
62 conformance
= org
.conformance
;
63 encoding
= org
.encoding
;
65 indentChars
= org
.indentChars
;
66 newLineChars
= org
.newLineChars
;
67 newLineOnAttributes
= org
.newLineOnAttributes
;
68 normalizeNewLines
= org
.normalizeNewLines
;
69 omitXmlDeclaration
= org
.omitXmlDeclaration
;
72 public XmlWriterSettings
Clone ()
74 return new XmlWriterSettings (this);
79 checkCharacters
= true;
80 closeOutput
= false; // ? not documented
81 conformance
= ConformanceLevel
.Document
;
82 encoding
= Encoding
.UTF8
;
85 // LAMESPEC: MS.NET says it is "\r\n", but it is silly decision.
86 newLineChars
= Environment
.NewLine
;
87 newLineOnAttributes
= false;
88 normalizeNewLines
= true;
89 omitXmlDeclaration
= false;
92 // It affects only on XmlTextWriter
93 public bool CheckCharacters
{
94 get { return checkCharacters; }
95 set { checkCharacters = value; }
98 // It affects only on XmlTextWriter
99 public bool CloseOutput
{
100 get { return closeOutput; }
101 set { closeOutput = value; }
104 // It affects only on XmlTextWriter????
105 public ConformanceLevel ConformanceLevel
{
106 get { return conformance; }
107 set { conformance = value; }
110 public Encoding Encoding
{
111 get { return encoding; }
112 set { encoding = value; }
115 // It affects only on XmlTextWriter
117 get { return indent; }
118 set { indent = value; }
121 // It affects only on XmlTextWriter
122 public string IndentChars
{
123 get { return indentChars; }
124 set { indentChars = value; }
127 // It affects only on XmlTextWriter
128 public string NewLineChars
{
129 get { return newLineChars; }
130 set { newLineChars = value; }
133 // It affects only on XmlTextWriter
134 public bool NewLineOnAttributes
{
135 get { return newLineOnAttributes; }
136 set { newLineOnAttributes = value; }
139 // It affects only on XmlTextWriter
140 public bool NormalizeNewLines
{
141 get { return normalizeNewLines; }
142 set { normalizeNewLines = value; }
145 // It affects only on XmlTextWriter
146 public bool OmitXmlDeclaration
{
147 get { return omitXmlDeclaration; }
148 set { omitXmlDeclaration = value; }