System.Xml.Schema.XsdBuilder.ParseBlockFinalEnum C# (CSharp) Method

ParseBlockFinalEnum() private method

private ParseBlockFinalEnum ( string value, string attributeName ) : int
value string
attributeName string
return int
        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;
        }

Usage Example

Esempio n. 1
0
 private static void BuildComplexType_Final(XsdBuilder builder, string value) {
     builder.complexType.Final = (XmlSchemaDerivationMethod)builder.ParseBlockFinalEnum(value, "final");
 }
All Usage Examples Of System.Xml.Schema.XsdBuilder::ParseBlockFinalEnum
XsdBuilder