internal void CompileFacetCombinations() {
RestrictionFacets baseRestriction = datatype.Restriction;
//They are not allowed on the same type but allowed on derived types.
if (
(derivedRestriction.Flags & RestrictionFlags.MaxInclusive) != 0 &&
(derivedRestriction.Flags & RestrictionFlags.MaxExclusive) != 0
) {
throw new XmlSchemaException(Res.Sch_MaxInclusiveExclusive, string.Empty);
}
if (
(derivedRestriction.Flags & RestrictionFlags.MinInclusive) != 0 &&
(derivedRestriction.Flags & RestrictionFlags.MinExclusive) != 0
) {
throw new XmlSchemaException(Res.Sch_MinInclusiveExclusive, string.Empty);
}
if (
(derivedRestriction.Flags & RestrictionFlags.Length) != 0 &&
(derivedRestriction.Flags & (RestrictionFlags.MinLength|RestrictionFlags.MaxLength)) != 0
) {
throw new XmlSchemaException(Res.Sch_LengthAndMinMax, string.Empty);
}
CopyFacetsFromBaseType();
// Check combinations
if (
(derivedRestriction.Flags & RestrictionFlags.MinLength) != 0 &&
(derivedRestriction.Flags & RestrictionFlags.MaxLength) != 0
) {
if (derivedRestriction.MinLength > derivedRestriction.MaxLength) {
throw new XmlSchemaException(Res.Sch_MinLengthGtMaxLength, string.Empty);
}
}
//TODO MinInc /MinExc /MaxInc / MaxExc checked in derived types
if (
(derivedRestriction.Flags & RestrictionFlags.MinInclusive) != 0 &&
(derivedRestriction.Flags & RestrictionFlags.MaxInclusive) != 0
) {
if (datatype.Compare(derivedRestriction.MinInclusive, derivedRestriction.MaxInclusive) > 0) {
throw new XmlSchemaException(Res.Sch_MinInclusiveGtMaxInclusive, string.Empty);
}
}
if (
(derivedRestriction.Flags & RestrictionFlags.MinInclusive) != 0 &&
(derivedRestriction.Flags & RestrictionFlags.MaxExclusive) != 0
) {
if (datatype.Compare(derivedRestriction.MinInclusive, derivedRestriction.MaxExclusive) > 0) {
throw new XmlSchemaException(Res.Sch_MinInclusiveGtMaxExclusive, string.Empty);
}
}
if (
(derivedRestriction.Flags & RestrictionFlags.MinExclusive) != 0 &&
(derivedRestriction.Flags & RestrictionFlags.MaxExclusive) != 0
) {
if (datatype.Compare(derivedRestriction.MinExclusive, derivedRestriction.MaxExclusive) > 0) {
throw new XmlSchemaException(Res.Sch_MinExclusiveGtMaxExclusive, string.Empty);
}
}
if (
(derivedRestriction.Flags & RestrictionFlags.MinExclusive) != 0 &&
(derivedRestriction.Flags & RestrictionFlags.MaxInclusive) != 0
) {
if (datatype.Compare(derivedRestriction.MinExclusive, derivedRestriction.MaxInclusive) > 0) {
throw new XmlSchemaException(Res.Sch_MinExclusiveGtMaxInclusive, string.Empty);
}
}
if ((derivedRestriction.Flags & (RestrictionFlags.TotalDigits|RestrictionFlags.FractionDigits)) == (RestrictionFlags.TotalDigits|RestrictionFlags.FractionDigits)) {
if (derivedRestriction.FractionDigits > derivedRestriction.TotalDigits) {
throw new XmlSchemaException(Res.Sch_FractionDigitsGtTotalDigits, string.Empty);
}
}
}