2010-04-07 Jb Evain <jbevain@novell.com>
[mcs.git] / class / System.XML / System.Xml / XmlWriterSettings.cs
blob8cfb78d3e5850987010b667d71a4455b41d09a71
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 sealed 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 NewLineHandling newLineHandling;
51 private bool omitXmlDeclaration;
52 private XmlOutputMethod outputMethod;
54 public XmlWriterSettings ()
56 Reset ();
59 public XmlWriterSettings Clone ()
61 return (XmlWriterSettings) MemberwiseClone ();
64 public void Reset ()
66 checkCharacters = true;
67 closeOutput = false; // ? not documented
68 conformance = ConformanceLevel.Document;
69 encoding = Encoding.UTF8;
70 indent = false;
71 indentChars = " ";
72 // LAMESPEC: MS.NET says it is "\r\n", but it is silly decision.
73 newLineChars = Environment.NewLine;
74 newLineOnAttributes = false;
75 newLineHandling = NewLineHandling.None;
76 omitXmlDeclaration = false;
77 outputMethod = XmlOutputMethod.AutoDetect;
80 // It affects only on XmlTextWriter
81 public bool CheckCharacters {
82 get { return checkCharacters; }
83 set { checkCharacters = value; }
86 // It affects only on XmlTextWriter
87 public bool CloseOutput {
88 get { return closeOutput; }
89 set { closeOutput = value; }
92 // It affects only on XmlTextWriter????
93 public ConformanceLevel ConformanceLevel {
94 get { return conformance; }
95 set { conformance = value; }
98 public Encoding Encoding {
99 get { return encoding; }
100 set { encoding = value; }
103 // It affects only on XmlTextWriter
104 public bool Indent {
105 get { return indent; }
106 set { indent = value; }
109 // It affects only on XmlTextWriter
110 public string IndentChars {
111 get { return indentChars; }
112 set { indentChars = value; }
115 // It affects only on XmlTextWriter
116 public string NewLineChars {
117 get { return newLineChars; }
118 set {
119 if (value == null)
120 throw new ArgumentNullException ("value");
121 newLineChars = value;
125 // It affects only on XmlTextWriter
126 public bool NewLineOnAttributes {
127 get { return newLineOnAttributes; }
128 set { newLineOnAttributes = value; }
131 // It affects only on XmlTextWriter
132 public NewLineHandling NewLineHandling {
133 get { return newLineHandling; }
134 set { newLineHandling = value; }
137 // It affects only on XmlTextWriter
138 public bool OmitXmlDeclaration {
139 get { return omitXmlDeclaration; }
140 set { omitXmlDeclaration = value; }
143 // does it affect only on XmlTextWriter?
144 public XmlOutputMethod OutputMethod {
145 get { return outputMethod; }
146 //set { outputMethod = value; }
149 #if MOONLIGHT || NET_4_0
150 public
151 #else
152 internal
153 #endif
154 NamespaceHandling NamespaceHandling { get; set; }
158 #endif