예제 #1
0
        /// <summary>Compiles the XML Schema definition language (XSD) schemas added to the <see cref="T:System.Xml.Schema.XmlSchemaSet" /> into one logical schema.</summary>
        /// <exception cref="T:System.Xml.Schema.XmlSchemaException">An error occurred when validating and compiling the schemas in the <see cref="T:System.Xml.Schema.XmlSchemaSet" />.</exception>
        public void Compile()
        {
            this.ClearGlobalComponents();
            ArrayList arrayList = new ArrayList();

            arrayList.AddRange(this.schemas);
            this.IDCollection.Clear();
            this.NamedIdentities.Clear();
            Hashtable handledUris = new Hashtable();

            foreach (object obj in arrayList)
            {
                XmlSchema xmlSchema = (XmlSchema)obj;
                if (!xmlSchema.IsCompiled)
                {
                    xmlSchema.CompileSubset(this.ValidationEventHandler, this, this.xmlResolver, handledUris);
                }
            }
            foreach (object obj2 in arrayList)
            {
                XmlSchema xmlSchema2 = (XmlSchema)obj2;
                foreach (object obj3 in xmlSchema2.Elements.Values)
                {
                    XmlSchemaElement xmlSchemaElement = (XmlSchemaElement)obj3;
                    xmlSchemaElement.FillSubstitutionElementInfo();
                }
            }
            foreach (object obj4 in arrayList)
            {
                XmlSchema xmlSchema3 = (XmlSchema)obj4;
                xmlSchema3.Validate(this.ValidationEventHandler);
            }
            foreach (object obj5 in arrayList)
            {
                XmlSchema schema = (XmlSchema)obj5;
                this.AddGlobalComponents(schema);
            }
            this.isCompiled = true;
        }