XmlReaderSettings.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. //
  2. // XmlReaderSettings.cs
  3. //
  4. // Author:
  5. // Atsushi Enomoto <[email protected]>
  6. //
  7. // (C) 2004 Novell Inc.
  8. //
  9. #if NET_2_0
  10. using System;
  11. using System.IO;
  12. using System.Net;
  13. using System.Xml.Schema;
  14. namespace System.Xml
  15. {
  16. public sealed class XmlReaderSettings : ICloneable
  17. {
  18. private bool checkCharacters;
  19. private bool closeInput;
  20. private ConformanceLevel conformance;
  21. private bool dtdValidate;
  22. private bool ignoreComments;
  23. private bool ignoreIdentityConstraints;
  24. private bool ignoreInlineSchema;
  25. private bool ignoreProcessingInstructions;
  26. private bool ignoreSchemaLocation;
  27. private bool ignoreValidationWarnings;
  28. private bool ignoreWhitespace;
  29. private int lineNumberOffset;
  30. private int linePositionOffset;
  31. private bool prohibitDtd;
  32. private XmlSchemaSet schemas;
  33. private bool xsdValidate;
  34. public XmlReaderSettings ()
  35. {
  36. Reset ();
  37. }
  38. private XmlReaderSettings (XmlReaderSettings org)
  39. {
  40. checkCharacters = org.checkCharacters;
  41. closeInput = org.closeInput;
  42. conformance = org.conformance;
  43. dtdValidate = org.dtdValidate;
  44. ignoreComments = org.ignoreComments;
  45. ignoreIdentityConstraints =
  46. org.ignoreIdentityConstraints;
  47. ignoreInlineSchema = org.ignoreInlineSchema;
  48. ignoreProcessingInstructions =
  49. org.ignoreProcessingInstructions;
  50. ignoreSchemaLocation = org.ignoreSchemaLocation;
  51. ignoreValidationWarnings = org.ignoreValidationWarnings;
  52. ignoreWhitespace = org.ignoreWhitespace;
  53. lineNumberOffset = org.lineNumberOffset;
  54. linePositionOffset = org.linePositionOffset;
  55. prohibitDtd = org.prohibitDtd;
  56. schemas = org.schemas;
  57. xsdValidate = org.xsdValidate;
  58. }
  59. public event ValidationEventHandler ValidationEventHandler;
  60. public XmlReaderSettings Clone ()
  61. {
  62. return new XmlReaderSettings (this);
  63. }
  64. object ICloneable.Clone ()
  65. {
  66. return this.Clone ();
  67. }
  68. public void Reset ()
  69. {
  70. checkCharacters = true;
  71. closeInput = false; // ? not documented
  72. conformance = ConformanceLevel.Document;
  73. dtdValidate = false;
  74. ignoreComments = false;
  75. ignoreIdentityConstraints = false; // ? not documented
  76. ignoreInlineSchema = true;
  77. ignoreProcessingInstructions = false;
  78. ignoreSchemaLocation = true;
  79. ignoreValidationWarnings = true;
  80. ignoreWhitespace = false;
  81. lineNumberOffset = 0;
  82. linePositionOffset = 0;
  83. prohibitDtd = false; // ? not documented
  84. schemas = new XmlSchemaSet ();
  85. xsdValidate = false;
  86. }
  87. public bool CheckCharacters {
  88. get { return checkCharacters; }
  89. set { checkCharacters = value; }
  90. }
  91. public bool CloseInput {
  92. get { return closeInput; }
  93. set { closeInput = value; }
  94. }
  95. public ConformanceLevel ConformanceLevel {
  96. get { return conformance; }
  97. set { conformance = value; }
  98. }
  99. public bool DtdValidate {
  100. get { return dtdValidate; }
  101. set { dtdValidate = value; }
  102. }
  103. public bool IgnoreComments {
  104. get { return ignoreComments; }
  105. set { ignoreComments = value; }
  106. }
  107. public bool IgnoreIdentityConstraints {
  108. get { return ignoreIdentityConstraints ; }
  109. set { ignoreIdentityConstraints = value; }
  110. }
  111. public bool IgnoreInlineSchema {
  112. get { return ignoreInlineSchema; }
  113. set { ignoreInlineSchema = value; }
  114. }
  115. public bool IgnoreProcessingInstructions {
  116. get { return ignoreProcessingInstructions; }
  117. set { ignoreProcessingInstructions = value; }
  118. }
  119. public bool IgnoreSchemaLocation {
  120. get { return ignoreSchemaLocation; }
  121. set { ignoreSchemaLocation = value; }
  122. }
  123. public bool IgnoreValidationWarnings {
  124. get { return ignoreValidationWarnings; }
  125. set { ignoreValidationWarnings = value; }
  126. }
  127. public bool IgnoreWhitespace {
  128. get { return ignoreWhitespace; }
  129. set { ignoreWhitespace = value; }
  130. }
  131. public int LineNumberOffset {
  132. get { return lineNumberOffset; }
  133. set { lineNumberOffset = value; }
  134. }
  135. public int LinePositionOffset {
  136. get { return linePositionOffset; }
  137. set { linePositionOffset = value; }
  138. }
  139. public bool ProhibitDtd {
  140. get { return prohibitDtd; }
  141. set { prohibitDtd = value; }
  142. }
  143. [MonoTODO ("Can set null value?")]
  144. public XmlSchemaSet Schemas {
  145. get { return schemas; }
  146. set { schemas = value; }
  147. }
  148. public bool XsdValidate {
  149. get { return xsdValidate; }
  150. set { xsdValidate = value; }
  151. }
  152. }
  153. }
  154. #endif