2 // System.Xml.Schema.XmlSchemaObject.cs
\r
5 // Dwivedi, Ajay kumar Adwiv@Yahoo.com
\r
6 // Enomoto, Atsushi ginga@kit.hi-ho.ne.jp
\r
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 using System.Collections;
\r
31 using System.Xml.Serialization;
\r
34 namespace System.Xml.Schema
\r
37 /// Summary description for XmlSchemaObject.
\r
39 public abstract class XmlSchemaObject
\r
41 private int lineNumber;
\r
42 private int linePosition;
\r
43 private string sourceUri;
\r
44 private XmlSerializerNamespaces namespaces;
\r
45 internal ArrayList unhandledAttributeList ;
\r
46 internal bool isCompiled = false;
\r
47 internal int errorCount = 0;
\r
48 internal Guid CompilationId;
\r
49 internal Guid ValidationId;
\r
50 internal bool isRedefineChild;
\r
51 internal bool isRedefinedComponent;
\r
52 internal XmlSchemaObject redefinedObject;
\r
54 protected XmlSchemaObject()
\r
56 namespaces = new XmlSerializerNamespaces();
\r
57 unhandledAttributeList = null;
\r
58 CompilationId = Guid.Empty;
\r
62 public int LineNumber
\r
64 get{ return lineNumber; }
\r
65 set{ lineNumber = value; }
\r
68 public int LinePosition
\r
70 get{ return linePosition; }
\r
71 set{ linePosition = value; }
\r
74 public string SourceUri
\r
76 get{ return sourceUri; }
\r
77 set{ sourceUri = value; }
\r
80 // Undocumented Property
\r
81 [XmlNamespaceDeclarations]
\r
82 public XmlSerializerNamespaces Namespaces
\r
84 get{ return namespaces; }
\r
85 set{ namespaces = value; }
\r
88 internal void error(ValidationEventHandler handle,string message)
\r
91 error (handle, message, null, this, null);
\r
93 internal void warn(ValidationEventHandler handle,string message)
\r
95 warn (handle, message, null, this, null);
\r
97 internal static void error(ValidationEventHandler handle, string message, Exception innerException)
\r
99 error (handle, message, innerException, null, null);
\r
101 internal static void warn(ValidationEventHandler handle, string message, Exception innerException)
\r
103 warn (handle, message, innerException, null, null);
\r
105 internal static void error(ValidationEventHandler handle,
\r
107 Exception innerException,
\r
108 XmlSchemaObject xsobj,
\r
111 ValidationHandler.RaiseValidationEvent (handle,
\r
117 XmlSeverityType.Error);
\r
119 internal static void warn(ValidationEventHandler handle,
\r
121 Exception innerException,
\r
122 XmlSchemaObject xsobj,
\r
125 ValidationHandler.RaiseValidationEvent (handle,
\r
131 XmlSeverityType.Warning);
\r
134 internal virtual int Compile (ValidationEventHandler h, XmlSchema schema)
\r
139 internal bool IsComplied (Guid compilationId)
\r
141 return this.CompilationId == compilationId;
\r
144 internal virtual int Validate (ValidationEventHandler h, XmlSchema schema)
\r
149 internal bool IsValidated (Guid validationId)
\r
151 return this.ValidationId == validationId;
\r
154 // This method is used only by particles
\r
155 internal virtual void CopyInfo (XmlSchemaParticle obj)
\r
157 obj.LineNumber = LineNumber;
\r
158 obj.LinePosition = LinePosition;
\r
159 obj.SourceUri = SourceUri;
\r
160 obj.errorCount = errorCount;
\r
161 // Other fields and properties may be useless for Particle.
\r