public static List<XmlSchemaAttribute> GetAttributes( XmlSchemaElement element )
{
var attributes = new List<XmlSchemaAttribute>();
if (element != null && element.ElementSchemaType != null)
{
var complexType = element.ElementSchemaType as XmlSchemaComplexType;
if (complexType != null)
attributes = GetAttributes( complexType );
}
return attributes;
}