internal void CompileMaxLengthFacet(XmlSchemaFacet facet) {
CheckProhibitedFlag(facet, RestrictionFlags.MaxLength, Res.Sch_MaxLengthFacetProhibited);
CheckDupFlag(facet, RestrictionFlags.MaxLength, Res.Sch_DupMaxLengthFacet);
derivedRestriction.MaxLength = XmlBaseConverter.DecimalToInt32((decimal)ParseFacetValue(nonNegativeInt, facet, Res.Sch_MaxLengthFacetInvalid, null, null));
if ((baseFixedFlags & RestrictionFlags.MaxLength) != 0) {
if (!datatype.IsEqual(datatype.Restriction.MaxLength, derivedRestriction.MaxLength)) {
throw new XmlSchemaException(Res.Sch_FacetBaseFixed, facet);
}
}
if ((baseFlags & RestrictionFlags.MaxLength) != 0) {
if (datatype.Restriction.MaxLength < derivedRestriction.MaxLength) {
throw new XmlSchemaException(Res.Sch_MaxLengthGtBaseMaxLength, facet);
}
}
if ((baseFlags & RestrictionFlags.Length) != 0) {
if (datatype.Restriction.Length > derivedRestriction.MaxLength) {
throw new XmlSchemaException(Res.Sch_MaxMinLengthBaseLength, facet);
}
}
SetFlag(facet, RestrictionFlags.MaxLength);
}