XmlSchemaObject.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. //
  2. // System.Xml.Schema.XmlSchemaObject.cs
  3. //
  4. // Authors:
  5. // Dwivedi, Ajay kumar [email protected]
  6. // Enomoto, Atsushi [email protected]
  7. //
  8. using System;
  9. using System.Collections;
  10. using System.Xml.Serialization;
  11. using System.Xml;
  12. namespace System.Xml.Schema
  13. {
  14. /// <summary>
  15. /// Summary description for XmlSchemaObject.
  16. /// </summary>
  17. public abstract class XmlSchemaObject
  18. {
  19. private int lineNumber;
  20. private int linePosition;
  21. private string sourceUri;
  22. private XmlSerializerNamespaces namespaces;
  23. internal ArrayList unhandledAttributeList ;
  24. internal bool isCompiled = false;
  25. internal int errorCount = 0;
  26. internal Guid CompilationId;
  27. internal Guid ValidationId;
  28. internal bool isRedefineChild;
  29. internal bool isRedefinedComponent;
  30. internal XmlSchemaObject redefinedObject;
  31. internal bool AttributeGroupRecursionCheck;
  32. protected XmlSchemaObject()
  33. {
  34. namespaces = new XmlSerializerNamespaces();
  35. unhandledAttributeList = null;
  36. CompilationId = Guid.Empty;
  37. }
  38. [XmlIgnore]
  39. public int LineNumber
  40. {
  41. get{ return lineNumber; }
  42. set{ lineNumber = value; }
  43. }
  44. [XmlIgnore]
  45. public int LinePosition
  46. {
  47. get{ return linePosition; }
  48. set{ linePosition = value; }
  49. }
  50. [XmlIgnore]
  51. public string SourceUri
  52. {
  53. get{ return sourceUri; }
  54. set{ sourceUri = value; }
  55. }
  56. // Undocumented Property
  57. [XmlNamespaceDeclarations]
  58. public XmlSerializerNamespaces Namespaces
  59. {
  60. get{ return namespaces; }
  61. set{ namespaces = value; }
  62. }
  63. internal void error(ValidationEventHandler handle,string message)
  64. {
  65. errorCount++;
  66. error (handle, message, null, this, null);
  67. }
  68. internal void warn(ValidationEventHandler handle,string message)
  69. {
  70. warn (handle, message, null, this, null);
  71. }
  72. internal static void error(ValidationEventHandler handle, string message, Exception innerException)
  73. {
  74. error (handle, message, innerException, null, null);
  75. }
  76. internal static void warn(ValidationEventHandler handle, string message, Exception innerException)
  77. {
  78. warn (handle, message, innerException, null, null);
  79. }
  80. internal static void error(ValidationEventHandler handle,
  81. string message,
  82. Exception innerException,
  83. XmlSchemaObject xsobj,
  84. object sender)
  85. {
  86. ValidationHandler.RaiseValidationEvent (handle,
  87. innerException,
  88. message,
  89. xsobj,
  90. sender,
  91. null,
  92. XmlSeverityType.Warning);
  93. }
  94. internal static void warn(ValidationEventHandler handle,
  95. string message,
  96. Exception innerException,
  97. XmlSchemaObject xsobj,
  98. object sender)
  99. {
  100. ValidationHandler.RaiseValidationEvent (handle,
  101. innerException,
  102. message,
  103. xsobj,
  104. sender,
  105. null,
  106. XmlSeverityType.Warning);
  107. }
  108. internal virtual int Compile (ValidationEventHandler h, XmlSchema schema)
  109. {
  110. return 0;
  111. }
  112. internal bool IsComplied (Guid compilationId)
  113. {
  114. return this.CompilationId == compilationId;
  115. }
  116. internal virtual int Validate (ValidationEventHandler h, XmlSchema schema)
  117. {
  118. return 0;
  119. }
  120. internal bool IsValidated (Guid validationId)
  121. {
  122. return this.ValidationId == validationId;
  123. }
  124. }
  125. }