private void AddAttribute(XmlSchemaObject value)
{
switch (this.ParentElement)
{
case SchemaNames.Token.XsdComplexType:
if (_complexType.ContentModel != null)
{
SendValidationEvent(SR.Sch_AttributeMutuallyExclusive, "attribute");
}
if (_complexType.AnyAttribute != null)
{
SendValidationEvent(SR.Sch_AnyAttributeLastChild, null);
}
_complexType.Attributes.Add(value);
break;
case SchemaNames.Token.XsdSimpleContentRestriction:
if (_simpleContentRestriction.AnyAttribute != null)
{
SendValidationEvent(SR.Sch_AnyAttributeLastChild, null);
}
_simpleContentRestriction.Attributes.Add(value);
break;
case SchemaNames.Token.XsdSimpleContentExtension:
if (_simpleContentExtension.AnyAttribute != null)
{
SendValidationEvent(SR.Sch_AnyAttributeLastChild, null);
}
_simpleContentExtension.Attributes.Add(value);
break;
case SchemaNames.Token.XsdComplexContentExtension:
if (_complexContentExtension.AnyAttribute != null)
{
SendValidationEvent(SR.Sch_AnyAttributeLastChild, null);
}
_complexContentExtension.Attributes.Add(value);
break;
case SchemaNames.Token.XsdComplexContentRestriction:
if (_complexContentRestriction.AnyAttribute != null)
{
SendValidationEvent(SR.Sch_AnyAttributeLastChild, null);
}
_complexContentRestriction.Attributes.Add(value);
break;
case SchemaNames.Token.xsdAttributeGroup:
if (_attributeGroup.AnyAttribute != null)
{
SendValidationEvent(SR.Sch_AnyAttributeLastChild, null);
}
_attributeGroup.Attributes.Add(value);
break;
default:
Debug.Assert(false);
break;
}
}