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

CheckAtrributeGroupRestriction() private method

private CheckAtrributeGroupRestriction ( XmlSchemaAttributeGroup baseAttributeGroup, XmlSchemaAttributeGroup derivedAttributeGroup ) : void
baseAttributeGroup XmlSchemaAttributeGroup
derivedAttributeGroup XmlSchemaAttributeGroup
return void
        private void CheckAtrributeGroupRestriction(XmlSchemaAttributeGroup baseAttributeGroup, XmlSchemaAttributeGroup derivedAttributeGroup) {
            XmlSchemaAnyAttribute baseAnyAtt = baseAttributeGroup.AttributeWildcard;
            XmlSchemaAnyAttribute derivedAnyAtt = derivedAttributeGroup.AttributeWildcard;

            if ((derivedAnyAtt != null) && (baseAnyAtt == null || !XmlSchemaAnyAttribute.IsSubset(derivedAnyAtt, baseAnyAtt) || !IsProcessContentsRestricted(null, derivedAnyAtt, baseAnyAtt))) {
                SendValidationEvent(Res.Sch_InvalidAnyAttributeRestriction, derivedAttributeGroup);
            }
            foreach(XmlSchemaAttribute attributeBase in baseAttributeGroup.AttributeUses.Values) {
                XmlSchemaAttribute attribute = (XmlSchemaAttribute)derivedAttributeGroup.AttributeUses[attributeBase.QualifiedName];
                if (attribute != null) {
                    if (attributeBase.Use == XmlSchemaUse.Prohibited && attribute.Use != XmlSchemaUse.Prohibited) {
                        SendValidationEvent(Res.Sch_AttributeRestrictionProhibited, attribute);
                    } 
                    else if (attributeBase.Use == XmlSchemaUse.Required && attribute.Use != XmlSchemaUse.Required) {
                        SendValidationEvent(Res.Sch_AttributeUseInvalid, attribute);
                    }
                    else if (attribute.Use == XmlSchemaUse.Prohibited) { //If derived att is prohibited, continue
                        continue;
                    }
                    else if (attributeBase.AttributeSchemaType == null || attribute.AttributeSchemaType == null || !XmlSchemaType.IsDerivedFrom(attribute.AttributeSchemaType, attributeBase.AttributeSchemaType, XmlSchemaDerivationMethod.Empty)) {
                        SendValidationEvent(Res.Sch_AttributeRestrictionInvalid, attribute);
                    }
                    else if (!IsFixedEqual(attributeBase.AttDef, attribute.AttDef)) {
                        SendValidationEvent(Res.Sch_AttributeFixedInvalid, attribute);
                    }    
                }
                else if (attributeBase.Use == XmlSchemaUse.Required) {
                    SendValidationEvent(Res.Sch_NoDerivedAttribute, attributeBase.QualifiedName.ToString(), baseAttributeGroup.QualifiedName.ToString(), derivedAttributeGroup);
                }
            }
            // Check additional ones are valid restriction of base's wildcard
            foreach(XmlSchemaAttribute attribute in derivedAttributeGroup.AttributeUses.Values) {
                XmlSchemaAttribute attributeBase = (XmlSchemaAttribute)baseAttributeGroup.AttributeUses[attribute.QualifiedName];
                if (attributeBase != null) {
                    continue;
                }
                if (baseAnyAtt == null || !baseAnyAtt.Allows(attribute.QualifiedName)) {
                    SendValidationEvent(Res.Sch_AttributeRestrictionInvalidFromWildcard, attribute);
                }
            }
        }
Compiler