public void IterateThrough(XmlSchemaElement obj) { if (obj.RefName.IsEmpty) { var sg = XmlSchemaExtensions.GetSubstitutionGroupElements(_schemaSet, obj); if (obj.IsAbstract && sg.Any()) { List <XmlSchemaElement> sgList; if (obj.IsAbstract) { sgList = sg.ToList(); } else { sgList = sg.ToList(); sgList.Add(obj); } _functionalVisitor.StartProcessingSubstitutionGroup(obj.Name); foreach (var element in sgList) { element.Accept(this); } _functionalVisitor.EndProcessingSubstitutionGroup(obj.Name); } else { if (_functionalVisitor.StartProcessing(obj)) { obj.Annotation?.Accept(this); if (obj.SchemaTypeName.Namespace != XmlSchema.Namespace) { obj.ElementSchemaType.Accept(this); } } _functionalVisitor.EndProcessing(obj); } } else { var refElement = XmlSchemaExtensions.GetGlobalElementByName(_schemaSet, obj.RefName); if (_functionalVisitor.StartProcessing(obj)) { refElement.Accept(this); } _functionalVisitor.EndProcessing(obj); } }