internal static XmlSchema GetParentSchema(XmlSchemaObject currentSchemaObject) {
XmlSchema parentSchema = null;
Debug.Assert((currentSchemaObject as XmlSchema) == null); //The current object should not be schema
while(parentSchema == null && currentSchemaObject != null) {
currentSchemaObject = currentSchemaObject.Parent;
parentSchema = currentSchemaObject as XmlSchema;
}
return parentSchema;
}