2 // XmlReaderSettings.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 XmlReaderSettings
42 private bool checkCharacters
;
43 private bool closeInput
;
44 private ConformanceLevel conformance
;
45 private bool dtdValidate
;
46 private bool ignoreComments
;
47 private bool ignoreIdentityConstraints
;
48 private bool ignoreInlineSchema
;
49 private bool ignoreProcessingInstructions
;
50 private bool ignoreSchemaLocation
;
51 private bool ignoreValidationWarnings
;
52 private bool ignoreWhitespace
;
53 private int lineNumberOffset
;
54 private int linePositionOffset
;
55 private bool prohibitDtd
;
56 private XmlNameTable nameTable
;
57 private XmlSchemaSet schemas
;
58 private bool xsdValidate
;
60 public XmlReaderSettings ()
65 private XmlReaderSettings (XmlReaderSettings org
)
67 checkCharacters
= org
.checkCharacters
;
68 closeInput
= org
.closeInput
;
69 conformance
= org
.conformance
;
70 dtdValidate
= org
.dtdValidate
;
71 ignoreComments
= org
.ignoreComments
;
72 ignoreIdentityConstraints
=
73 org
.ignoreIdentityConstraints
;
74 ignoreInlineSchema
= org
.ignoreInlineSchema
;
75 ignoreProcessingInstructions
=
76 org
.ignoreProcessingInstructions
;
77 ignoreSchemaLocation
= org
.ignoreSchemaLocation
;
78 ignoreValidationWarnings
= org
.ignoreValidationWarnings
;
79 ignoreWhitespace
= org
.ignoreWhitespace
;
80 lineNumberOffset
= org
.lineNumberOffset
;
81 linePositionOffset
= org
.linePositionOffset
;
82 prohibitDtd
= org
.prohibitDtd
;
83 schemas
= org
.schemas
;
84 xsdValidate
= org
.xsdValidate
;
85 nameTable
= org
.NameTable
;
88 public event ValidationEventHandler ValidationEventHandler
;
90 public XmlReaderSettings
Clone ()
92 return new XmlReaderSettings (this);
97 checkCharacters
= true;
98 closeInput
= false; // ? not documented
99 conformance
= ConformanceLevel
.Document
;
101 ignoreComments
= false;
102 ignoreIdentityConstraints
= false; // ? not documented
103 ignoreInlineSchema
= true;
104 ignoreProcessingInstructions
= false;
105 ignoreSchemaLocation
= true;
106 ignoreValidationWarnings
= true;
107 ignoreWhitespace
= false;
108 lineNumberOffset
= 0;
109 linePositionOffset
= 0;
110 prohibitDtd
= false; // ? not documented
111 schemas
= new XmlSchemaSet ();
115 public bool CheckCharacters
{
116 get { return checkCharacters; }
117 set { checkCharacters = value; }
120 public bool CloseInput
{
121 get { return closeInput; }
122 set { closeInput = value; }
125 public ConformanceLevel ConformanceLevel
{
126 get { return conformance; }
127 set { conformance = value; }
130 public bool DtdValidate
{
131 get { return dtdValidate; }
132 set { dtdValidate = value; }
135 public bool IgnoreComments
{
136 get { return ignoreComments; }
137 set { ignoreComments = value; }
140 public bool IgnoreIdentityConstraints
{
141 get { return ignoreIdentityConstraints ; }
142 set { ignoreIdentityConstraints = value; }
145 public bool IgnoreInlineSchema
{
146 get { return ignoreInlineSchema; }
147 set { ignoreInlineSchema = value; }
150 public bool IgnoreProcessingInstructions
{
151 get { return ignoreProcessingInstructions; }
152 set { ignoreProcessingInstructions = value; }
155 public bool IgnoreSchemaLocation
{
156 get { return ignoreSchemaLocation; }
157 set { ignoreSchemaLocation = value; }
160 public bool IgnoreValidationWarnings
{
161 get { return ignoreValidationWarnings; }
162 set { ignoreValidationWarnings = value; }
165 public bool IgnoreWhitespace
{
166 get { return ignoreWhitespace; }
167 set { ignoreWhitespace = value; }
170 public int LineNumberOffset
{
171 get { return lineNumberOffset; }
172 set { lineNumberOffset = value; }
175 public int LinePositionOffset
{
176 get { return linePositionOffset; }
177 set { linePositionOffset = value; }
180 public bool ProhibitDtd
{
181 get { return prohibitDtd; }
182 set { prohibitDtd = value; }
185 // LAMESPEC: MSDN documentation says "An empty XmlNameTable
186 // object" for default value, but XmlNameTable cannot be
187 // instantiate. It actually returns null by default.
188 public XmlNameTable NameTable
{
189 get { return nameTable; }
190 set { nameTable = value; }
193 // LAMESPEC: Apparently, this property should not have a setter.
194 public XmlSchemaSet Schemas
{
195 get { return schemas; }
197 throw new XmlException ("XmlReaderSettings.Schemas is read-only and cannot be set.");
201 public bool XsdValidate
{
202 get { return xsdValidate; }
203 set { xsdValidate = value; }