private void Compile() {
this.schema.SchemaTypes.Insert(DatatypeImplementation.QnAnyType, XmlSchemaComplexType.AnyType);
foreach (XmlSchemaSubstitutionGroupV1Compat substitutionGroup in examplars.Values) {
CompileSubstitutionGroup(substitutionGroup);
}
foreach (XmlSchemaGroup group in this.schema.Groups.Values) {
CompileGroup(group);
}
foreach (XmlSchemaAttributeGroup attributeGroup in this.schema.AttributeGroups.Values) {
CompileAttributeGroup(attributeGroup);
}
foreach (XmlSchemaType type in this.schema.SchemaTypes.Values) {
if (type is XmlSchemaComplexType) {
CompileComplexType((XmlSchemaComplexType)type);
}
else {
CompileSimpleType((XmlSchemaSimpleType)type);
}
}
foreach (XmlSchemaElement element in this.schema.Elements.Values) {
if (element.ElementDecl == null) {
CompileElement(element);
}
}
foreach (XmlSchemaAttribute attribute in this.schema.Attributes.Values) {
if (attribute.AttDef == null) {
CompileAttribute(attribute);
}
}
foreach (XmlSchemaIdentityConstraint identityConstraint in this.schema.IdentityConstraints.Values) {
if (identityConstraint.CompiledConstraint == null) {
CompileIdentityConstraint(identityConstraint);
}
}
while (this.complexTypeStack.Count > 0) {
XmlSchemaComplexType type = (XmlSchemaComplexType)complexTypeStack.Pop();
CompileCompexTypeElements(type);
}
foreach (XmlSchemaType type in this.schema.SchemaTypes.Values) {
if (type is XmlSchemaComplexType) {
CheckParticleDerivation((XmlSchemaComplexType)type);
}
}
foreach (XmlSchemaElement element in this.schema.Elements.Values) {
if (element.ElementSchemaType is XmlSchemaComplexType && element.SchemaTypeName == XmlQualifiedName.Empty) { // only local schemaTypes
CheckParticleDerivation((XmlSchemaComplexType)element.ElementSchemaType);
}
}
foreach (XmlSchemaSubstitutionGroup substitutionGroup in examplars.Values) {
CheckSubstitutionGroup(substitutionGroup);
}
this.schema.SchemaTypes.Remove(DatatypeImplementation.QnAnyType); //For backward compatibility
}