public static bool getAttributes(object item, List <XmlSchemaAttribute> attributes) { if (item is XmlSchemaComplexType) { XmlSchemaComplexType complexType = (XmlSchemaComplexType)item; foreach (object entry in complexType.AttributeUses) { object o = null; if (entry is System.Collections.DictionaryEntry) { System.Collections.DictionaryEntry de = (System.Collections.DictionaryEntry)entry; object key = de.Key; object value = de.Value; o = value; } if (o is XmlSchemaAttribute) { attributes.Add((XmlSchemaAttribute)o); } else if (o is XmlSchemaAttributeGroupRef) { XmlSchemaAttributeGroupRef groupRef = (XmlSchemaAttributeGroupRef)o; XmlQualifiedName qname = groupRef.RefName; if (qname != null) { XmlSchemaAttributeGroup group = null; if (SchemaManager.GetAttributeGroup(qname.Namespace, qname.Name, out group)) { foreach (object oo in group.Attributes) { if (oo is XmlSchemaAttribute) { attributes.Add((XmlSchemaAttribute)oo); } } } } } } if (complexType.ContentModel != null && complexType.ContentModel.Content is XmlSchemaComplexContentExtension) { XmlSchemaComplexContentExtension ext = (XmlSchemaComplexContentExtension)complexType.ContentModel.Content; XmlSchemaComplexType baseType; if (ext.BaseTypeName != null && SchemaManager.GetComplexType(ext.BaseTypeName.Namespace, ext.BaseTypeName.Name, out baseType)) { getAttributes(baseType, attributes); } } } return(attributes.Count > 0); }