System.Xml.Schema.SchemaCollectionCompiler.Execute C# (CSharp) Méthode

Execute() public méthode

public Execute ( XmlSchema schema, SchemaInfo schemaInfo, bool compileContentModel ) : bool
schema XmlSchema
schemaInfo SchemaInfo
compileContentModel bool
Résultat bool
        public bool Execute(XmlSchema schema, SchemaInfo schemaInfo, bool compileContentModel) {
            this.compileContentModel = compileContentModel;
            this.schema = schema;
            Prepare();
            Cleanup();
            Compile();
            if (!HasErrors) {
                Output(schemaInfo);
            }
            return !HasErrors;
        }

Usage Example

#pragma warning disable 618
        internal bool CompileSchema(XmlSchemaCollection xsc, XmlResolver resolver, SchemaInfo schemaInfo, string ns, ValidationEventHandler validationEventHandler, XmlNameTable nameTable, bool CompileContentModel) {

            //Need to lock here to prevent multi-threading problems when same schema is added to set and compiled
            lock (this) {
                //Preprocessing
                SchemaCollectionPreprocessor prep = new SchemaCollectionPreprocessor(nameTable, null, validationEventHandler);
                prep.XmlResolver = resolver;
                if (!prep.Execute(this, ns, true, xsc)) {
                    return false;
                }
            
                //Compilation
                SchemaCollectionCompiler compiler = new SchemaCollectionCompiler(nameTable, validationEventHandler);
                isCompiled = compiler.Execute(this, schemaInfo, CompileContentModel);
                this.SetIsCompiled(isCompiled);
                //TODO includes isCompiled flag
                return isCompiled;
            }
        }