private static void CleanupElement(XmlSchemaElement element) {
if (element.SchemaType != null) {
XmlSchemaComplexType complexType = element.SchemaType as XmlSchemaComplexType;
if (complexType != null) {
CleanupComplexType(complexType);
}
else {
CleanupSimpleType((XmlSchemaSimpleType)element.SchemaType);
}
}
foreach (XmlSchemaIdentityConstraint constr in element.Constraints) {
constr.CompiledConstraint = null;
}
element.ElementDecl = null;
}