myFacets[SchemaType.FACET_MAX_LENGTH] != null)
{
state.error("Cannot specify length in addition to minLength or maxLength", XmlErrorContext.FACET_DUPLICATED, facet);
continue;
}
XmlInteger len = StscTranslator.buildNnInteger(facet.getValue());
if (len == null)
{
state.error("Must be a nonnegative integer", XmlErrorContext.FACET_VALUE_MALFORMED, facet);
continue;
}
if (fixedFacets[code] && !myFacets[code].valueEquals(len))
{
state.error("This facet is fixed and cannot be overridden", XmlErrorContext.FACET_FIXED, facet);
continue;
}
myFacets[code] = len;
break;
case SchemaType.FACET_MIN_LENGTH:
case SchemaType.FACET_MAX_LENGTH:
if (myFacets[SchemaType.FACET_LENGTH] != null)
{
state.error("Cannot specify minLength or maxLength in addition to length", XmlErrorContext.FACET_DUPLICATED, facet);
continue;
}
XmlInteger mlen = StscTranslator.buildNnInteger(facet.getValue());
if (mlen == null)
{
state.error("Must be a nonnegative integer", XmlErrorContext.FACET_VALUE_MALFORMED, facet);
continue;
}
if (fixedFacets[code] && !myFacets[code].valueEquals(mlen))
{
state.error("This facet is fixed and cannot be overridden", XmlErrorContext.FACET_FIXED, facet);
continue;
}
if (myFacets[SchemaType.FACET_MAX_LENGTH] != null)
{
if (mlen.compareValue(myFacets[SchemaType.FACET_MAX_LENGTH]) > 0)
{
state.error("Larger than prior maxLength", XmlErrorContext.FACET_VALUE_MALFORMED, facet);
continue;
}
}
if (myFacets[SchemaType.FACET_MIN_LENGTH] != null)
{
if (mlen.compareValue(myFacets[SchemaType.FACET_MIN_LENGTH]) < 0)
{
state.error("Smaller than prior minLength", XmlErrorContext.FACET_VALUE_MALFORMED, facet);
continue;
}
}
myFacets[code] = mlen;
break;
case SchemaType.FACET_TOTAL_DIGITS:
case SchemaType.FACET_FRACTION_DIGITS:
boolean istotaldig = (code == SchemaType.FACET_TOTAL_DIGITS);
XmlInteger dig = StscTranslator.buildNnInteger(facet.getValue());
if (dig == null)
{
state.error("Must be a nonnegative integer", XmlErrorContext.FACET_VALUE_MALFORMED, facet);
break;
}
if (fixedFacets[code] && !myFacets[code].valueEquals(dig))
{
state.error("This facet is fixed and cannot be overridden", XmlErrorContext.FACET_FIXED, facet);
continue;
}
if (myFacets[SchemaType.FACET_TOTAL_DIGITS] != null)
{
if (dig.compareValue(myFacets[SchemaType.FACET_TOTAL_DIGITS]) > 0)
state.error("Larger than prior totalDigits", XmlErrorContext.FACET_VALUE_MALFORMED, facet);
}
if (!istotaldig && myFacets[SchemaType.FACET_FRACTION_DIGITS] != null)
{
if (dig.compareValue(myFacets[SchemaType.FACET_FRACTION_DIGITS]) > 0)
state.error("Larger than prior fractionDigits", XmlErrorContext.FACET_VALUE_MALFORMED, facet);
}
myFacets[code] = dig;
break;