2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / class / System.XML / System.Xml / XmlWriterSettings.cs
1 //\r
2 // XmlWriterSettings.cs\r
3 //\r
4 // Author:\r
5 //   Atsushi Enomoto <atsushi@ximian.com>\r
6 //\r
7 // (C) 2004 Novell Inc.\r
8 //\r
9
10 //
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.
29 //
30 \r
31 #if NET_2_0\r
32 \r
33 using System;\r
34 using System.IO;\r
35 using System.Text;\r
36 using System.Xml.Schema;\r
37 \r
38 namespace System.Xml\r
39 {\r
40         public class XmlWriterSettings\r
41         {\r
42                 private bool checkCharacters;\r
43                 private bool closeOutput;\r
44                 private ConformanceLevel conformance;\r
45                 private Encoding encoding;\r
46                 private bool indent;\r
47                 private string indentChars;\r
48                 private string newLineChars;\r
49                 private bool newLineOnAttributes;\r
50                 private bool normalizeNewLines;\r
51                 private bool omitXmlDeclaration;\r
52 \r
53                 public XmlWriterSettings ()\r
54                 {\r
55                         Reset ();\r
56                 }\r
57 \r
58                 private XmlWriterSettings (XmlWriterSettings org)\r
59                 {\r
60                         checkCharacters = org.checkCharacters;\r
61                         closeOutput = org.closeOutput;\r
62                         conformance = org.conformance;\r
63                         encoding = org.encoding;\r
64                         indent = org.indent;\r
65                         indentChars = org.indentChars;\r
66                         newLineChars = org.newLineChars;\r
67                         newLineOnAttributes = org.newLineOnAttributes;\r
68                         normalizeNewLines = org.normalizeNewLines;\r
69                         omitXmlDeclaration = org.omitXmlDeclaration;\r
70                 }\r
71 \r
72                 public XmlWriterSettings Clone ()\r
73                 {\r
74                         return new XmlWriterSettings (this);\r
75                 }\r
76 \r
77                 public void Reset ()\r
78                 {\r
79                         checkCharacters = true;\r
80                         closeOutput = false; // ? not documented\r
81                         conformance = ConformanceLevel.Document;\r
82                         encoding = Encoding.UTF8;\r
83                         indent = false;\r
84                         indentChars = "  ";\r
85                         // LAMESPEC: MS.NET says it is "\r\n", but it is silly decision.\r
86                         newLineChars = Environment.NewLine;\r
87                         newLineOnAttributes = false;\r
88                         normalizeNewLines = true;\r
89                         omitXmlDeclaration = false;\r
90                 }\r
91 \r
92                 // It affects only on XmlTextWriter\r
93                 public bool CheckCharacters {\r
94                         get { return checkCharacters; }\r
95                         set { checkCharacters = value; }\r
96                 }\r
97 \r
98                 // It affects only on XmlTextWriter\r
99                 public bool CloseOutput {\r
100                         get { return closeOutput; }\r
101                         set { closeOutput = value; }\r
102                 }\r
103 \r
104                 // It affects only on XmlTextWriter????\r
105                 public ConformanceLevel ConformanceLevel {\r
106                         get { return conformance; }\r
107                         set { conformance = value; }\r
108                 }\r
109 \r
110                 public Encoding Encoding {\r
111                         get { return encoding; }\r
112                         set { encoding = value; }\r
113                 }\r
114 \r
115                 // It affects only on XmlTextWriter\r
116                 public bool Indent {\r
117                         get { return indent; }\r
118                         set { indent = value; }\r
119                 }\r
120 \r
121                 // It affects only on XmlTextWriter\r
122                 public string IndentChars {\r
123                         get { return indentChars; }\r
124                         set { indentChars = value; }\r
125                 }\r
126 \r
127                 // It affects only on XmlTextWriter\r
128                 public string NewLineChars {\r
129                         get { return newLineChars; }\r
130                         set { newLineChars = value; }\r
131                 }\r
132 \r
133                 // It affects only on XmlTextWriter\r
134                 public bool NewLineOnAttributes {\r
135                         get { return newLineOnAttributes; }\r
136                         set { newLineOnAttributes = value; }\r
137                 }\r
138 \r
139                 // It affects only on XmlTextWriter\r
140                 public bool NormalizeNewLines {\r
141                         get { return normalizeNewLines; }\r
142                         set { normalizeNewLines = value; }\r
143                 }\r
144 \r
145                 // It affects only on XmlTextWriter\r
146                 public bool OmitXmlDeclaration {\r
147                         get { return omitXmlDeclaration; }\r
148                         set { omitXmlDeclaration = value; }\r
149                 }\r
150         }\r
151 }\r
152 \r
153 #endif\r