Package org.apache.xmlbeans

Examples of org.apache.xmlbeans.XmlInteger$Factory


//                            myFacets[SchemaType.FACET_MAX_LENGTH] != null)
//                        {
//                            state.error(XmlErrorCodes.DATATYPE_LENGTH, null, facet);
//                            continue;
//                        }
                        XmlInteger len = StscTranslator.buildNnInteger(facet.getValue());
                        if (len == null)
                        {
                            state.error("Must be a nonnegative integer", XmlErrorCodes.FACET_VALUE_MALFORMED, facet);
                            continue;
                        }
                        if (fixedFacets[code] && !myFacets[code].valueEquals(len))
                        {
                            state.error(XmlErrorCodes.FACET_FIXED, new Object[] { facetName }, facet);
                            continue;
                        }
                        if (myFacets[SchemaType.FACET_MIN_LENGTH] != null)
                        {
                            // An error for 'length' and 'minLength' to be specified at the same time
                            // except if the base type had the same value for 'minLength' also
                            XmlAnySimpleType baseMinLength = baseImpl.getFacet(SchemaType.FACET_MIN_LENGTH);
                            if (!(baseMinLength != null &&
                                baseMinLength.valueEquals(myFacets[SchemaType.FACET_MIN_LENGTH]) &&
                                baseMinLength.compareValue(len) <= 0))
                            {
                                state.error(XmlErrorCodes.DATATYPE_LENGTH, null, facet);
                                continue;
                            }
                        }
                        if (myFacets[SchemaType.FACET_MAX_LENGTH] != null)
                        {
                            // An error for 'length' and 'maxLength' to be specified at the same time
                            // except if the base type had the same value for 'maxLength' also
                            XmlAnySimpleType baseMaxLength = baseImpl.getFacet(SchemaType.FACET_MAX_LENGTH);
                            if (!(baseMaxLength != null &&
                                baseMaxLength.valueEquals(myFacets[SchemaType.FACET_MAX_LENGTH]) &&
                                baseMaxLength.compareValue(len) >= 0))
                            {
                                state.error(XmlErrorCodes.DATATYPE_LENGTH, null, facet);
                                continue;
                            }
                        }
                        myFacets[code] = len;
                        break;

                    case SchemaType.FACET_MIN_LENGTH:
                    case SchemaType.FACET_MAX_LENGTH:
                        XmlInteger mlen = StscTranslator.buildNnInteger(facet.getValue());
                        if (mlen == null)
                        {
                            state.error("Must be a nonnegative integer", XmlErrorCodes.FACET_VALUE_MALFORMED, facet);
                            continue;
                        }
                        if (fixedFacets[code] && !myFacets[code].valueEquals(mlen))
                        {
                            state.error(XmlErrorCodes.FACET_FIXED, new Object[] { facetName }, facet);
                            continue;
                        }
                        if (myFacets[SchemaType.FACET_LENGTH] != null)
                        {
                            // It's an error for 'length' and 'minLength'/'maxLength' to be
                            // specified at the same time, except for the case when
                            // the base type had the same value for 'minLength'/'maxLength'
                            // and the two values are consistent
                            XmlAnySimpleType baseMinMaxLength = baseImpl.getFacet(code);
                            if (!(baseMinMaxLength != null &&
                                baseMinMaxLength.valueEquals(mlen) &&
                                (code == SchemaType.FACET_MIN_LENGTH ?
                                    baseMinMaxLength.compareTo(myFacets[SchemaType.FACET_LENGTH]) <= 0 :
                                    baseMinMaxLength.compareTo(myFacets[SchemaType.FACET_LENGTH]) >= 0)))
                            {
                                state.error(XmlErrorCodes.DATATYPE_LENGTH, null, facet);
                                continue;
                            }
                        }
                        if (myFacets[SchemaType.FACET_MAX_LENGTH] != null)
                        {
                            if (mlen.compareValue(myFacets[SchemaType.FACET_MAX_LENGTH]) > 0)
                            {
                                state.error(XmlErrorCodes.DATATYPE_MAX_LENGTH_RESTRICTION, null, facet);
                                continue;
                            }
                        }
                        if (myFacets[SchemaType.FACET_MIN_LENGTH] != null)
                        {
                            if (mlen.compareValue(myFacets[SchemaType.FACET_MIN_LENGTH]) < 0)
                            {
                                state.error(XmlErrorCodes.DATATYPE_MIN_LENGTH_RESTRICTION, null, facet);
                                continue;
                            }
                        }
View Full Code Here


                            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;
                            }
                        }
View Full Code Here

//                            myFacets[SchemaType.FACET_MAX_LENGTH] != null)
//                        {
//                            state.error(XmlErrorCodes.DATATYPE_LENGTH, null, facet);
//                            continue;
//                        }
                        XmlInteger len = StscTranslator.buildNnInteger(facet.getValue());
                        if (len == null)
                        {
                            state.error("Must be a nonnegative integer", XmlErrorCodes.FACET_VALUE_MALFORMED, facet);
                            continue;
                        }
                        if (fixedFacets[code] && !myFacets[code].valueEquals(len))
                        {
                            state.error(XmlErrorCodes.FACET_FIXED, new Object[] { facetName }, facet);
                            continue;
                        }
                        if (myFacets[SchemaType.FACET_MIN_LENGTH] != null)
                        {
                            // An error for 'length' and 'minLength' to be specified at the same time
                            // except if the base type had the same value for 'minLength' also
                            XmlAnySimpleType baseMinLength = baseImpl.getFacet(SchemaType.FACET_MIN_LENGTH);
                            if (!(baseMinLength != null &&
                                baseMinLength.valueEquals(myFacets[SchemaType.FACET_MIN_LENGTH]) &&
                                baseMinLength.compareValue(len) <= 0))
                            {
                                state.error(XmlErrorCodes.DATATYPE_LENGTH, null, facet);
                                continue;
                            }
                        }
                        if (myFacets[SchemaType.FACET_MAX_LENGTH] != null)
                        {
                            // An error for 'length' and 'maxLength' to be specified at the same time
                            // except if the base type had the same value for 'maxLength' also
                            XmlAnySimpleType baseMaxLength = baseImpl.getFacet(SchemaType.FACET_MAX_LENGTH);
                            if (!(baseMaxLength != null &&
                                baseMaxLength.valueEquals(myFacets[SchemaType.FACET_MAX_LENGTH]) &&
                                baseMaxLength.compareValue(len) >= 0))
                            {
                                state.error(XmlErrorCodes.DATATYPE_LENGTH, null, facet);
                                continue;
                            }
                        }
                        myFacets[code] = len;
                        break;

                    case SchemaType.FACET_MIN_LENGTH:
                    case SchemaType.FACET_MAX_LENGTH:
                        XmlInteger mlen = StscTranslator.buildNnInteger(facet.getValue());
                        if (mlen == null)
                        {
                            state.error("Must be a nonnegative integer", XmlErrorCodes.FACET_VALUE_MALFORMED, facet);
                            continue;
                        }
                        if (fixedFacets[code] && !myFacets[code].valueEquals(mlen))
                        {
                            state.error(XmlErrorCodes.FACET_FIXED, new Object[] { facetName }, facet);
                            continue;
                        }
                        if (myFacets[SchemaType.FACET_LENGTH] != null)
                        {
                            // It's an error for 'length' and 'minLength'/'maxLength' to be
                            // specified at the same time, except for the case when
                            // the base type had the same value for 'minLength'/'maxLength'
                            // and the two values are consistent
                            XmlAnySimpleType baseMinMaxLength = baseImpl.getFacet(code);
                            if (!(baseMinMaxLength != null &&
                                baseMinMaxLength.valueEquals(mlen) &&
                                (code == SchemaType.FACET_MIN_LENGTH ?
                                    baseMinMaxLength.compareTo(myFacets[SchemaType.FACET_LENGTH]) <= 0 :
                                    baseMinMaxLength.compareTo(myFacets[SchemaType.FACET_LENGTH]) >= 0)))
                            {
                                state.error(XmlErrorCodes.DATATYPE_LENGTH, null, facet);
                                continue;
                            }
                        }
                        if (myFacets[SchemaType.FACET_MAX_LENGTH] != null)
                        {
                            if (mlen.compareValue(myFacets[SchemaType.FACET_MAX_LENGTH]) > 0)
                            {
                                state.error(XmlErrorCodes.DATATYPE_MAX_LENGTH_RESTRICTION, null, facet);
                                continue;
                            }
                        }
                        if (myFacets[SchemaType.FACET_MIN_LENGTH] != null)
                        {
                            if (mlen.compareValue(myFacets[SchemaType.FACET_MIN_LENGTH]) < 0)
                            {
                                state.error(XmlErrorCodes.DATATYPE_MIN_LENGTH_RESTRICTION, null, facet);
                                continue;
                            }
                        }
View Full Code Here

//                            myFacets[SchemaType.FACET_MAX_LENGTH] != null)
//                        {
//                            state.error(XmlErrorCodes.DATATYPE_LENGTH, null, facet);
//                            continue;
//                        }
                        XmlInteger len = StscTranslator.buildNnInteger(facet.getValue());
                        if (len == null)
                        {
                            state.error("Must be a nonnegative integer", XmlErrorCodes.FACET_VALUE_MALFORMED, facet);
                            continue;
                        }
                        if (fixedFacets[code] && !myFacets[code].valueEquals(len))
                        {
                            state.error(XmlErrorCodes.FACET_FIXED, new Object[] { facetName }, facet);
                            continue;
                        }
                        if (myFacets[SchemaType.FACET_MIN_LENGTH] != null)
                        {
                            // An error for 'length' and 'minLength' to be specified at the same time
                            // except if the base type had the same value for 'minLength' also
                            XmlAnySimpleType baseMinLength = baseImpl.getFacet(SchemaType.FACET_MIN_LENGTH);
                            if (!(baseMinLength != null &&
                                baseMinLength.valueEquals(myFacets[SchemaType.FACET_MIN_LENGTH]) &&
                                baseMinLength.compareValue(len) <= 0))
                            {
                                state.error(XmlErrorCodes.DATATYPE_LENGTH, null, facet);
                                continue;
                            }
                        }
                        if (myFacets[SchemaType.FACET_MAX_LENGTH] != null)
                        {
                            // An error for 'length' and 'maxLength' to be specified at the same time
                            // except if the base type had the same value for 'maxLength' also
                            XmlAnySimpleType baseMaxLength = baseImpl.getFacet(SchemaType.FACET_MAX_LENGTH);
                            if (!(baseMaxLength != null &&
                                baseMaxLength.valueEquals(myFacets[SchemaType.FACET_MAX_LENGTH]) &&
                                baseMaxLength.compareValue(len) >= 0))
                            {
                                state.error(XmlErrorCodes.DATATYPE_LENGTH, null, facet);
                                continue;
                            }
                        }
                        myFacets[code] = len;
                        break;

                    case SchemaType.FACET_MIN_LENGTH:
                    case SchemaType.FACET_MAX_LENGTH:
                        XmlInteger mlen = StscTranslator.buildNnInteger(facet.getValue());
                        if (mlen == null)
                        {
                            state.error("Must be a nonnegative integer", XmlErrorCodes.FACET_VALUE_MALFORMED, facet);
                            continue;
                        }
                        if (fixedFacets[code] && !myFacets[code].valueEquals(mlen))
                        {
                            state.error(XmlErrorCodes.FACET_FIXED, new Object[] { facetName }, facet);
                            continue;
                        }
                        if (myFacets[SchemaType.FACET_LENGTH] != null)
                        {
                            // It's an error for 'length' and 'minLength'/'maxLength' to be
                            // specified at the same time, except for the case when
                            // the base type had the same value for 'minLength'/'maxLength'
                            // and the two values are consistent
                            XmlAnySimpleType baseMinMaxLength = baseImpl.getFacet(code);
                            if (!(baseMinMaxLength != null &&
                                baseMinMaxLength.valueEquals(mlen) &&
                                (code == SchemaType.FACET_MIN_LENGTH ?
                                    baseMinMaxLength.compareTo(myFacets[SchemaType.FACET_LENGTH]) <= 0 :
                                    baseMinMaxLength.compareTo(myFacets[SchemaType.FACET_LENGTH]) >= 0)))
                            {
                                state.error(XmlErrorCodes.DATATYPE_LENGTH, null, facet);
                                continue;
                            }
                        }
                        if (myFacets[SchemaType.FACET_MAX_LENGTH] != null)
                        {
                            if (mlen.compareValue(myFacets[SchemaType.FACET_MAX_LENGTH]) > 0)
                            {
                                state.error(XmlErrorCodes.DATATYPE_MAX_LENGTH_RESTRICTION, null, facet);
                                continue;
                            }
                        }
                        if (myFacets[SchemaType.FACET_MIN_LENGTH] != null)
                        {
                            if (mlen.compareValue(myFacets[SchemaType.FACET_MIN_LENGTH]) < 0)
                            {
                                state.error(XmlErrorCodes.DATATYPE_MIN_LENGTH_RESTRICTION, null, facet);
                                continue;
                            }
                        }
View Full Code Here

        return sb.toString();
    }

    private int pickLength(SchemaType sType)
    {
        XmlInteger length = (XmlInteger) sType.getFacet(SchemaType.FACET_LENGTH);
        if (length != null)
            return length.getBigIntegerValue().intValue();
        XmlInteger min    = (XmlInteger) sType.getFacet(SchemaType.FACET_MIN_LENGTH);
        XmlInteger max    = (XmlInteger) sType.getFacet(SchemaType.FACET_MAX_LENGTH);
        int minInt, maxInt;
        if (min == null)
            minInt = 0;
        else
            minInt = min.getBigIntegerValue().intValue();
        if (max == null)
            maxInt = Integer.MAX_VALUE;
        else
            maxInt = max.getBigIntegerValue().intValue();
        // We try to keep the length of the array within reasonable limits,
        // at least 1 item and at most 3 if possible
        if (minInt == 0 && maxInt >= 1)
            minInt = 1;
        if (maxInt > minInt + 2)
View Full Code Here

            sb.append(Integer.toString(pick(10)));
        return sb.toString();
    }

    private int pickLength(SchemaType sType) {
        XmlInteger length = (XmlInteger) sType.getFacet(SchemaType.FACET_LENGTH);
        if (length != null)
            return length.getBigIntegerValue().intValue();
        XmlInteger min = (XmlInteger) sType.getFacet(SchemaType.FACET_MIN_LENGTH);
        XmlInteger max = (XmlInteger) sType.getFacet(SchemaType.FACET_MAX_LENGTH);
        int minInt, maxInt;
        if (min == null)
            minInt = 0;
        else
            minInt = min.getBigIntegerValue().intValue();
        if (max == null)
            maxInt = Integer.MAX_VALUE;
        else
            maxInt = max.getBigIntegerValue().intValue();
        // We try to keep the length of the array within reasonable limits,
        // at least 1 item and at most 3 if possible
        if (minInt == 0 && maxInt >= 1)
            minInt = 1;
        if (maxInt > minInt + 2)
View Full Code Here

                            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;
                            }
                        }
View Full Code Here

                            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;
View Full Code Here

        return sb.toString();
    }

    private int pickLength(SchemaType sType)
    {
        XmlInteger length = (XmlInteger) sType.getFacet(SchemaType.FACET_LENGTH);
        if (length != null)
            return length.getBigIntegerValue().intValue();
        XmlInteger min    = (XmlInteger) sType.getFacet(SchemaType.FACET_MIN_LENGTH);
        XmlInteger max    = (XmlInteger) sType.getFacet(SchemaType.FACET_MAX_LENGTH);
        int minInt, maxInt;
        if (min == null)
            minInt = 0;
        else
            minInt = min.getBigIntegerValue().intValue();
        if (max == null)
            maxInt = Integer.MAX_VALUE;
        else
            maxInt = max.getBigIntegerValue().intValue();
        // We try to keep the length of the array within reasonable limits,
        // at least 1 item and at most 3 if possible
        if (minInt == 0 && maxInt >= 1)
            minInt = 1;
        if (maxInt > minInt + 2)
View Full Code Here

//                            myFacets[SchemaType.FACET_MAX_LENGTH] != null)
//                        {
//                            state.error(XmlErrorCodes.DATATYPE_LENGTH, null, facet);
//                            continue;
//                        }
                        XmlInteger len = StscTranslator.buildNnInteger(facet.getValue());
                        if (len == null)
                        {
                            state.error("Must be a nonnegative integer", XmlErrorCodes.FACET_VALUE_MALFORMED, facet);
                            continue;
                        }
                        if (fixedFacets[code] && !myFacets[code].valueEquals(len))
                        {
                            state.error(XmlErrorCodes.FACET_FIXED, new Object[] { facetName }, facet);
                            continue;
                        }
                        if (myFacets[SchemaType.FACET_MIN_LENGTH] != null)
                        {
                            // An error for 'length' and 'minLength' to be specified at the same time
                            // except if the base type had the same value for 'minLength' also
                            XmlAnySimpleType baseMinLength = baseImpl.getFacet(SchemaType.FACET_MIN_LENGTH);
                            if (!(baseMinLength != null &&
                                baseMinLength.valueEquals(myFacets[SchemaType.FACET_MIN_LENGTH]) &&
                                baseMinLength.compareValue(len) <= 0))
                            {
                                state.error(XmlErrorCodes.DATATYPE_LENGTH, null, facet);
                                continue;
                            }
                        }
                        if (myFacets[SchemaType.FACET_MAX_LENGTH] != null)
                        {
                            // An error for 'length' and 'maxLength' to be specified at the same time
                            // except if the base type had the same value for 'maxLength' also
                            XmlAnySimpleType baseMaxLength = baseImpl.getFacet(SchemaType.FACET_MAX_LENGTH);
                            if (!(baseMaxLength != null &&
                                baseMaxLength.valueEquals(myFacets[SchemaType.FACET_MAX_LENGTH]) &&
                                baseMaxLength.compareValue(len) >= 0))
                            {
                                state.error(XmlErrorCodes.DATATYPE_LENGTH, null, facet);
                                continue;
                            }
                        }
                        myFacets[code] = len;
                        break;

                    case SchemaType.FACET_MIN_LENGTH:
                    case SchemaType.FACET_MAX_LENGTH:
                        XmlInteger mlen = StscTranslator.buildNnInteger(facet.getValue());
                        if (mlen == null)
                        {
                            state.error("Must be a nonnegative integer", XmlErrorCodes.FACET_VALUE_MALFORMED, facet);
                            continue;
                        }
                        if (fixedFacets[code] && !myFacets[code].valueEquals(mlen))
                        {
                            state.error(XmlErrorCodes.FACET_FIXED, new Object[] { facetName }, facet);
                            continue;
                        }
                        if (myFacets[SchemaType.FACET_LENGTH] != null)
                        {
                            // It's an error for 'length' and 'minLength'/'maxLength' to be
                            // specified at the same time, except for the case when
                            // the base type had the same value for 'minLength'/'maxLength'
                            // and the two values are consistent
                            XmlAnySimpleType baseMinMaxLength = baseImpl.getFacet(code);
                            if (!(baseMinMaxLength != null &&
                                baseMinMaxLength.valueEquals(mlen) &&
                                (code == SchemaType.FACET_MIN_LENGTH ?
                                    baseMinMaxLength.compareTo(myFacets[SchemaType.FACET_LENGTH]) <= 0 :
                                    baseMinMaxLength.compareTo(myFacets[SchemaType.FACET_LENGTH]) >= 0)))
                            {
                                state.error(XmlErrorCodes.DATATYPE_LENGTH, null, facet);
                                continue;
                            }
                        }
                        if (myFacets[SchemaType.FACET_MAX_LENGTH] != null)
                        {
                            if (mlen.compareValue(myFacets[SchemaType.FACET_MAX_LENGTH]) > 0)
                            {
                                state.error(XmlErrorCodes.DATATYPE_MAX_LENGTH_RESTRICTION, null, facet);
                                continue;
                            }
                        }
                        if (myFacets[SchemaType.FACET_MIN_LENGTH] != null)
                        {
                            if (mlen.compareValue(myFacets[SchemaType.FACET_MIN_LENGTH]) < 0)
                            {
                                state.error(XmlErrorCodes.DATATYPE_MIN_LENGTH_RESTRICTION, null, facet);
                                continue;
                            }
                        }
View Full Code Here

TOP

Related Classes of org.apache.xmlbeans.XmlInteger$Factory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.