internal void CompileLengthFacet(XmlSchemaFacet facet) {
CheckProhibitedFlag(facet, RestrictionFlags.Length, Res.Sch_LengthFacetProhibited);
CheckDupFlag(facet, RestrictionFlags.Length, Res.Sch_DupLengthFacet);
derivedRestriction.Length = XmlBaseConverter.DecimalToInt32((decimal)ParseFacetValue(nonNegativeInt, facet, Res.Sch_LengthFacetInvalid, null, null));
if ((baseFixedFlags & RestrictionFlags.Length) != 0) {
if (!datatype.IsEqual(datatype.Restriction.Length, derivedRestriction.Length)) {
throw new XmlSchemaException(Res.Sch_FacetBaseFixed, facet);
}
}
if ((baseFlags & RestrictionFlags.Length) != 0) {
if (datatype.Restriction.Length < derivedRestriction.Length) {
throw new XmlSchemaException(Res.Sch_LengthGtBaseLength, facet);
}
}
if ((baseFlags & RestrictionFlags.MinLength) != 0 || (baseFlags & RestrictionFlags.MaxLength) != 0) {
if (datatype.Restriction.MaxLength < derivedRestriction.Length || datatype.Restriction.MinLength > derivedRestriction.Length) {
throw new XmlSchemaException(Res.Sch_MaxMinLengthBaseLength, facet);
}
}
SetFlag(facet, RestrictionFlags.Length);
}