public List<XmlSchemaAttribute> GetAttributes(XmlNode node)
{
List<XmlSchemaAttribute> listOfAttributes = new List<XmlSchemaAttribute>();
XmlSchemaElement element = Elements.Where(e => e.Name.Equals(node.LocalName)).FirstOrDefault();
if (element != null)
{
XmlSchemaComplexType type = element.ElementSchemaType as XmlSchemaComplexType;
if (type != null)
{
// If the complex type has any attributes, get an enumerator
// and write each attribute name to the Debug.
if (type.AttributeUses.Count > 0)
{
foreach (XmlSchemaObject obj in type.AttributeUses.Values)
{
XmlSchemaAttribute attr = (XmlSchemaAttribute)obj;
listOfAttributes.Add(attr);
}
}
}
}
return listOfAttributes;
}