private int ParseBlockFinalEnum(string value, string attributeName)
{
const int HashAllLength = 4; // Length of "#all"
int r = 0;
string[] stringValues = XmlConvert.SplitString(value);
for (int i = 0; i < stringValues.Length; i++)
{
bool matched = false;
for (int j = 0; j < s_derivationMethodStrings.Length; j++)
{
if (stringValues[i] == s_derivationMethodStrings[j])
{
if ((r & s_derivationMethodValues[j]) != 0 && (r & s_derivationMethodValues[j]) != s_derivationMethodValues[j])
{
SendValidationEvent(SR.Sch_InvalidXsdAttributeValue, attributeName, value, null);
return 0;
}
r |= s_derivationMethodValues[j];
matched = true;
break;
}
}
if (!matched)
{
SendValidationEvent(SR.Sch_InvalidXsdAttributeValue, attributeName, value, null);
return 0;
}
if (r == (int)XmlSchemaDerivationMethod.All && value.Length > HashAllLength)
{ //#all is not allowed with other values
SendValidationEvent(SR.Sch_InvalidXsdAttributeValue, attributeName, value, null);
return 0;
}
}
return r;
}