System.Xml.Schema.Compiler.CompileAttributeGroup C# (CSharp) Method

CompileAttributeGroup() private method

private CompileAttributeGroup ( XmlSchemaAttributeGroup attributeGroup ) : void
attributeGroup XmlSchemaAttributeGroup
return void
        private void CompileAttributeGroup(XmlSchemaAttributeGroup attributeGroup) {
            if (attributeGroup.IsProcessing) {
                SendValidationEvent(Res.Sch_AttributeGroupCircularRef, attributeGroup);
                return;
            }
            if (attributeGroup.AttributeUses.Count > 0) {// already checked
                return;
            }
            attributeGroup.IsProcessing = true;
            XmlSchemaAnyAttribute anyAttribute = attributeGroup.AnyAttribute;

            try {
                foreach (XmlSchemaObject obj in attributeGroup.Attributes) {
                    if (obj is XmlSchemaAttribute) {
                        XmlSchemaAttribute attribute = (XmlSchemaAttribute)obj;
                        if (attribute.Use == XmlSchemaUse.Prohibited) {
                            continue;
                        }
                        CompileAttribute(attribute);
                        if (attributeGroup.AttributeUses[attribute.QualifiedName] == null) {
                            attributeGroup.AttributeUses.Add(attribute.QualifiedName, attribute);
                        }
                        else  {
                            SendValidationEvent(Res.Sch_DupAttributeUse, attribute.QualifiedName.ToString(), attribute);
                        }
                    }
                    else { // XmlSchemaAttributeGroupRef
                        XmlSchemaAttributeGroupRef attributeGroupRef = (XmlSchemaAttributeGroupRef)obj;
                        XmlSchemaAttributeGroup attributeGroupResolved;
                        if (attributeGroup.Redefined != null && attributeGroupRef.RefName == attributeGroup.Redefined.QualifiedName) {
                            attributeGroupResolved = (XmlSchemaAttributeGroup)attributeGroup.Redefined;
                        }
                        else {
                            attributeGroupResolved = (XmlSchemaAttributeGroup)attributeGroups[attributeGroupRef.RefName];
                        }
                        if (attributeGroupResolved != null) {
                            CompileAttributeGroup(attributeGroupResolved);
                            foreach (XmlSchemaAttribute attribute in attributeGroupResolved.AttributeUses.Values) {
                                if (attributeGroup.AttributeUses[attribute.QualifiedName] == null) {
                                    attributeGroup.AttributeUses.Add(attribute.QualifiedName, attribute);
                                }
                                else {
                                    SendValidationEvent(Res.Sch_DupAttributeUse, attribute.QualifiedName.ToString(), attribute);
                                }
                            }
                            anyAttribute = CompileAnyAttributeIntersection(anyAttribute, attributeGroupResolved.AttributeWildcard);
                        }
                        else {
                            SendValidationEvent(Res.Sch_UndefAttributeGroupRef, attributeGroupRef.RefName.ToString(), attributeGroupRef);
                        }
                    }
                }          
                attributeGroup.AttributeWildcard = anyAttribute;
            }
            finally {
                attributeGroup.IsProcessing = false;
            }
        }
Compiler