Compiles the XML Schema Object Model (SOM) into schema information for validation. Used to check the syntactic and semantic structure of the programmatically built SOM. Semantic validation checking is performed during compilation.
If the SOM references other namespaces through the import or include elements, the XmlResolver is used to resolve these references. If the resolver is set to null, this indicates that the user does not care about resolving import or include elements. In this case, the references are not resolved. The resolver is not cached after the Compile method completes.
The XmlSchema.Compile(ValidationEventHandler, System.Xml.XmlResolver) method is obsolete in the Microsoft .NET Framework version 2.0 and has been replaced by the XmlSchemaSet.Compile method.
The XmlSchema.Compile(ValidationEventHandler, System.Xml.XmlResolver) method uses the System.Xml.XmlUrlResolver class to resolve external schemas referenced in include, import, or redefine elements by default. You can disable resolution of external schemas by passing null as the System.Xml.XmlResolver parameter.