internal static XmlSchema GetSchemaWithGlobalElementDeclaration(XmlSchemaElement element, XmlSchemaSet schemas)
{
ICollection currentSchemas = schemas.Schemas();
foreach (XmlSchema schema in currentSchemas)
{
foreach (XmlSchemaObject schemaObject in schema.Items)
{
XmlSchemaElement schemaElement = schemaObject as XmlSchemaElement;
if (schemaElement == null)
continue;
if (schemaElement == element)
{
return schema;
}
}
}
return null;
}