internal override Exception CheckValueFacets(byte[] value, XmlSchemaDatatype datatype) {
//Length, MinLength, MaxLength
RestrictionFacets restriction = datatype.Restriction;
int length = value.Length;
RestrictionFlags flags = restriction != null ? restriction.Flags : 0;
if (flags != 0) { //if it has facets defined
if ((flags & RestrictionFlags.Length) != 0) {
if (restriction.Length != length) {
return new XmlSchemaException(Res.Sch_LengthConstraintFailed, string.Empty);
}
}
if ((flags & RestrictionFlags.MinLength) != 0) {
if (length < restriction.MinLength) {
return new XmlSchemaException(Res.Sch_MinLengthConstraintFailed, string.Empty);
}
}
if ((flags & RestrictionFlags.MaxLength) != 0) {
if (restriction.MaxLength < length) {
return new XmlSchemaException(Res.Sch_MaxLengthConstraintFailed, string.Empty);
}
}
if ((flags & RestrictionFlags.Enumeration) != 0) {
if (!MatchEnumeration(value, restriction.Enumeration, datatype)) {
return new XmlSchemaException(Res.Sch_EnumerationConstraintFailed, string.Empty);
}
}
}
return null;
}
internal override bool MatchEnumeration(object value, ArrayList enumeration, XmlSchemaDatatype datatype) {