**** Merged from MCS ****
[mono-project.git] / mcs / class / System.XML / System.Xml / XmlWriterSettings.cs
blob76c0a07b89616df89a9f9114a78616b2fd7ded4e
1 //
2 // XmlWriterSettings.cs
3 //
4 // Author:
5 // Atsushi Enomoto <atsushi@ximian.com>
6 //
7 // (C) 2004 Novell Inc.
8 //
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:
18 //
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 //
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.
31 #if NET_2_0
33 using System;
34 using System.IO;
35 using System.Text;
36 using System.Xml.Schema;
38 namespace System.Xml
40 public class XmlWriterSettings
42 private bool checkCharacters;
43 private bool closeOutput;
44 private ConformanceLevel conformance;
45 private Encoding encoding;
46 private bool indent;
47 private string indentChars;
48 private string newLineChars;
49 private bool newLineOnAttributes;
50 private bool normalizeNewLines;
51 private bool omitXmlDeclaration;
53 public XmlWriterSettings ()
55 Reset ();
58 private XmlWriterSettings (XmlWriterSettings org)
60 checkCharacters = org.checkCharacters;
61 closeOutput = org.closeOutput;
62 conformance = org.conformance;
63 encoding = org.encoding;
64 indent = org.indent;
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);
77 public void Reset ()
79 checkCharacters = true;
80 closeOutput = false; // ? not documented
81 conformance = ConformanceLevel.Document;
82 encoding = Encoding.UTF8;
83 indent = false;
84 indentChars = " ";
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
116 public bool Indent {
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; }
153 #endif