com.sun.org.apache.xerces.internal.impl.dv.ValidatedInfo Java Examples

The following examples show how to use com.sun.org.apache.xerces.internal.impl.dv.ValidatedInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XSSimpleTypeDecl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * validate an actual value against this DV
 *
 * @param context       the validation context
 * @param validatedInfo used to provide the actual value and member types
 */
public void validate(ValidationContext context, ValidatedInfo validatedInfo)
    throws InvalidDatatypeValueException {

    if (context == null)
        context = fEmptyContext;

    // then validate the actual value against the facets
    if (context.needFacetChecking() &&
            (fFacetsDefined != 0 && fFacetsDefined != FACET_WHITESPACE)) {
        checkFacets(validatedInfo);
    }

    // now check extra rules: for ID/IDREF/ENTITY
    if (context.needExtraChecking()) {
        checkExtraRules(context, validatedInfo);
    }

}
 
Example #2
Source File: XSSimpleTypeDecl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * validate an actual value against this DV
 *
 * @param context       the validation context
 * @param validatedInfo used to provide the actual value and member types
 */
public void validate(ValidationContext context, ValidatedInfo validatedInfo)
    throws InvalidDatatypeValueException {

    if (context == null)
        context = fEmptyContext;

    // then validate the actual value against the facets
    if (context.needFacetChecking() &&
            (fFacetsDefined != 0 && fFacetsDefined != FACET_WHITESPACE)) {
        checkFacets(validatedInfo);
    }

    // now check extra rules: for ID/IDREF/ENTITY
    if (context.needExtraChecking()) {
        checkExtraRules(context, validatedInfo);
    }

}
 
Example #3
Source File: XSSimpleTypeDecl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * validate an actual value against this DV
 *
 * @param context       the validation context
 * @param validatedInfo used to provide the actual value and member types
 */
public void validate(ValidationContext context, ValidatedInfo validatedInfo)
    throws InvalidDatatypeValueException {

    if (context == null)
        context = fEmptyContext;

    // then validate the actual value against the facets
    if (context.needFacetChecking() &&
            (fFacetsDefined != 0 && fFacetsDefined != FACET_WHITESPACE)) {
        checkFacets(validatedInfo);
    }

    // now check extra rules: for ID/IDREF/ENTITY
    if (context.needExtraChecking()) {
        checkExtraRules(context, validatedInfo);
    }

}
 
Example #4
Source File: XSSimpleTypeDecl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * validate an actual value against this DV
 *
 * @param context       the validation context
 * @param validatedInfo used to provide the actual value and member types
 */
public void validate(ValidationContext context, ValidatedInfo validatedInfo)
    throws InvalidDatatypeValueException {

    if (context == null)
        context = fEmptyContext;

    // then validate the actual value against the facets
    if (context.needFacetChecking() &&
            (fFacetsDefined != 0 && fFacetsDefined != FACET_WHITESPACE)) {
        checkFacets(validatedInfo);
    }

    // now check extra rules: for ID/IDREF/ENTITY
    if (context.needExtraChecking()) {
        checkExtraRules(context, validatedInfo);
    }

}
 
Example #5
Source File: XSSimpleTypeDecl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * validate an actual value against this DV
 *
 * @param context       the validation context
 * @param validatedInfo used to provide the actual value and member types
 */
public void validate(ValidationContext context, ValidatedInfo validatedInfo)
    throws InvalidDatatypeValueException {

    if (context == null)
        context = fEmptyContext;

    // then validate the actual value against the facets
    if (context.needFacetChecking() &&
            (fFacetsDefined != 0 && fFacetsDefined != FACET_WHITESPACE)) {
        checkFacets(validatedInfo);
    }

    // now check extra rules: for ID/IDREF/ENTITY
    if (context.needExtraChecking()) {
        checkExtraRules(context, validatedInfo);
    }

}
 
Example #6
Source File: XSSimpleTypeDecl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * validate an actual value against this DV
 *
 * @param context       the validation context
 * @param validatedInfo used to provide the actual value and member types
 */
public void validate(ValidationContext context, ValidatedInfo validatedInfo)
    throws InvalidDatatypeValueException {

    if (context == null)
        context = fEmptyContext;

    // then validate the actual value against the facets
    if (context.needFacetChecking() &&
            (fFacetsDefined != 0 && fFacetsDefined != FACET_WHITESPACE)) {
        checkFacets(validatedInfo);
    }

    // now check extra rules: for ID/IDREF/ENTITY
    if (context.needExtraChecking()) {
        checkExtraRules(context, validatedInfo);
    }

}
 
Example #7
Source File: XSSimpleTypeDecl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * validate an actual value against this DV
 *
 * @param context       the validation context
 * @param validatedInfo used to provide the actual value and member types
 */
public void validate(ValidationContext context, ValidatedInfo validatedInfo)
    throws InvalidDatatypeValueException {

    if (context == null)
        context = fEmptyContext;

    // then validate the actual value against the facets
    if (context.needFacetChecking() &&
            (fFacetsDefined != 0 && fFacetsDefined != FACET_WHITESPACE)) {
        checkFacets(validatedInfo);
    }

    // now check extra rules: for ID/IDREF/ENTITY
    if (context.needExtraChecking()) {
        checkExtraRules(context, validatedInfo);
    }

}
 
Example #8
Source File: XSSimpleTypeDecl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * validate an actual value against this DV
 *
 * @param context       the validation context
 * @param validatedInfo used to provide the actual value and member types
 */
public void validate(ValidationContext context, ValidatedInfo validatedInfo)
    throws InvalidDatatypeValueException {

    if (context == null)
        context = fEmptyContext;

    // then validate the actual value against the facets
    if (context.needFacetChecking() &&
            (fFacetsDefined != 0 && fFacetsDefined != FACET_WHITESPACE)) {
        checkFacets(validatedInfo);
    }

    // now check extra rules: for ID/IDREF/ENTITY
    if (context.needExtraChecking()) {
        checkExtraRules(context, validatedInfo);
    }

}
 
Example #9
Source File: XSSimpleTypeDecl.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * validate an actual value against this DV
 *
 * @param context       the validation context
 * @param validatedInfo used to provide the actual value and member types
 */
public void validate(ValidationContext context, ValidatedInfo validatedInfo)
    throws InvalidDatatypeValueException {

    if (context == null)
        context = fEmptyContext;

    // then validate the actual value against the facets
    if (context.needFacetChecking() &&
            (fFacetsDefined != 0 && fFacetsDefined != FACET_WHITESPACE)) {
        checkFacets(validatedInfo);
    }

    // now check extra rules: for ID/IDREF/ENTITY
    if (context.needExtraChecking()) {
        checkExtraRules(context, validatedInfo);
    }

}
 
Example #10
Source File: XMLSchemaValidator.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/** Returns true if the two ValidatedInfo objects can be compared in the same value space. **/
private boolean isComparable(ValidatedInfo info1, ValidatedInfo info2) {
    final short primitiveType1 = convertToPrimitiveKind(info1.actualValueType);
    final short primitiveType2 = convertToPrimitiveKind(info2.actualValueType);
    if (primitiveType1 != primitiveType2) {
        return (primitiveType1 == XSConstants.ANYSIMPLETYPE_DT && primitiveType2 == XSConstants.STRING_DT ||
                primitiveType1 == XSConstants.STRING_DT && primitiveType2 == XSConstants.ANYSIMPLETYPE_DT);
    }
    else if (primitiveType1 == XSConstants.LIST_DT || primitiveType1 == XSConstants.LISTOFUNION_DT) {
        final ShortList typeList1 = info1.itemValueTypes;
        final ShortList typeList2 = info2.itemValueTypes;
        final int typeList1Length = typeList1 != null ? typeList1.getLength() : 0;
        final int typeList2Length = typeList2 != null ? typeList2.getLength() : 0;
        if (typeList1Length != typeList2Length) {
            return false;
        }
        for (int i = 0; i < typeList1Length; ++i) {
            final short primitiveItem1 = convertToPrimitiveKind(typeList1.item(i));
            final short primitiveItem2 = convertToPrimitiveKind(typeList2.item(i));
            if (primitiveItem1 != primitiveItem2) {
                if (primitiveItem1 == XSConstants.ANYSIMPLETYPE_DT && primitiveItem2 == XSConstants.STRING_DT ||
                    primitiveItem1 == XSConstants.STRING_DT && primitiveItem2 == XSConstants.ANYSIMPLETYPE_DT) {
                    continue;
                }
                return false;
            }
        }
    }
    return true;
}
 
Example #11
Source File: XMLSchemaValidator.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/** Returns true if the two ValidatedInfo objects can be compared in the same value space. **/
private boolean isComparable(ValidatedInfo info1, ValidatedInfo info2) {
    final short primitiveType1 = convertToPrimitiveKind(info1.actualValueType);
    final short primitiveType2 = convertToPrimitiveKind(info2.actualValueType);
    if (primitiveType1 != primitiveType2) {
        return (primitiveType1 == XSConstants.ANYSIMPLETYPE_DT && primitiveType2 == XSConstants.STRING_DT ||
                primitiveType1 == XSConstants.STRING_DT && primitiveType2 == XSConstants.ANYSIMPLETYPE_DT);
    }
    else if (primitiveType1 == XSConstants.LIST_DT || primitiveType1 == XSConstants.LISTOFUNION_DT) {
        final ShortList typeList1 = info1.itemValueTypes;
        final ShortList typeList2 = info2.itemValueTypes;
        final int typeList1Length = typeList1 != null ? typeList1.getLength() : 0;
        final int typeList2Length = typeList2 != null ? typeList2.getLength() : 0;
        if (typeList1Length != typeList2Length) {
            return false;
        }
        for (int i = 0; i < typeList1Length; ++i) {
            final short primitiveItem1 = convertToPrimitiveKind(typeList1.item(i));
            final short primitiveItem2 = convertToPrimitiveKind(typeList2.item(i));
            if (primitiveItem1 != primitiveItem2) {
                if (primitiveItem1 == XSConstants.ANYSIMPLETYPE_DT && primitiveItem2 == XSConstants.STRING_DT ||
                    primitiveItem1 == XSConstants.STRING_DT && primitiveItem2 == XSConstants.ANYSIMPLETYPE_DT) {
                    continue;
                }
                return false;
            }
        }
    }
    return true;
}
 
Example #12
Source File: XSSimpleTypeDecl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void checkExtraRules(ValidationContext context, ValidatedInfo validatedInfo) throws InvalidDatatypeValueException {

        Object ob = validatedInfo.actualValue;

        if (fVariety == VARIETY_ATOMIC) {

            fDVs[fValidationDV].checkExtraRules(ob, context);

        } else if (fVariety == VARIETY_LIST) {

            ListDV.ListData values = (ListDV.ListData)ob;
            XSSimpleType memberType = validatedInfo.memberType;
            int len = values.getLength();
            try {
                if (fItemType.fVariety == VARIETY_UNION) {
                    XSSimpleTypeDecl[] memberTypes = (XSSimpleTypeDecl[])validatedInfo.memberTypes;
                    for (int i = len-1; i >= 0; i--) {
                        validatedInfo.actualValue = values.item(i);
                        validatedInfo.memberType = memberTypes[i];
                        fItemType.checkExtraRules(context, validatedInfo);
                    }
                } else { // (fVariety == VARIETY_ATOMIC)
                    for (int i = len-1; i >= 0; i--) {
                        validatedInfo.actualValue = values.item(i);
                        fItemType.checkExtraRules(context, validatedInfo);
                    }
                }
            }
            finally {
                validatedInfo.actualValue = values;
                validatedInfo.memberType = memberType;
            }

        } else { // (fVariety == VARIETY_UNION)

            ((XSSimpleTypeDecl)validatedInfo.memberType).checkExtraRules(context, validatedInfo);

        }

    }
 
Example #13
Source File: XSSimpleTypeDecl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void checkExtraRules(ValidationContext context, ValidatedInfo validatedInfo) throws InvalidDatatypeValueException {

        Object ob = validatedInfo.actualValue;

        if (fVariety == VARIETY_ATOMIC) {

            fDVs[fValidationDV].checkExtraRules(ob, context);

        } else if (fVariety == VARIETY_LIST) {

            ListDV.ListData values = (ListDV.ListData)ob;
            XSSimpleType memberType = validatedInfo.memberType;
            int len = values.getLength();
            try {
                if (fItemType.fVariety == VARIETY_UNION) {
                    XSSimpleTypeDecl[] memberTypes = (XSSimpleTypeDecl[])validatedInfo.memberTypes;
                    for (int i = len-1; i >= 0; i--) {
                        validatedInfo.actualValue = values.item(i);
                        validatedInfo.memberType = memberTypes[i];
                        fItemType.checkExtraRules(context, validatedInfo);
                    }
                } else { // (fVariety == VARIETY_ATOMIC)
                    for (int i = len-1; i >= 0; i--) {
                        validatedInfo.actualValue = values.item(i);
                        fItemType.checkExtraRules(context, validatedInfo);
                    }
                }
            }
            finally {
                validatedInfo.actualValue = values;
                validatedInfo.memberType = memberType;
            }

        } else { // (fVariety == VARIETY_UNION)

            ((XSSimpleTypeDecl)validatedInfo.memberType).checkExtraRules(context, validatedInfo);

        }

    }
 
Example #14
Source File: XMLSchemaValidator.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/** Returns true if the two ValidatedInfo objects can be compared in the same value space. **/
private boolean isComparable(ValidatedInfo info1, ValidatedInfo info2) {
    final short primitiveType1 = convertToPrimitiveKind(info1.actualValueType);
    final short primitiveType2 = convertToPrimitiveKind(info2.actualValueType);
    if (primitiveType1 != primitiveType2) {
        return (primitiveType1 == XSConstants.ANYSIMPLETYPE_DT && primitiveType2 == XSConstants.STRING_DT ||
                primitiveType1 == XSConstants.STRING_DT && primitiveType2 == XSConstants.ANYSIMPLETYPE_DT);
    }
    else if (primitiveType1 == XSConstants.LIST_DT || primitiveType1 == XSConstants.LISTOFUNION_DT) {
        final ShortList typeList1 = info1.itemValueTypes;
        final ShortList typeList2 = info2.itemValueTypes;
        final int typeList1Length = typeList1 != null ? typeList1.getLength() : 0;
        final int typeList2Length = typeList2 != null ? typeList2.getLength() : 0;
        if (typeList1Length != typeList2Length) {
            return false;
        }
        for (int i = 0; i < typeList1Length; ++i) {
            final short primitiveItem1 = convertToPrimitiveKind(typeList1.item(i));
            final short primitiveItem2 = convertToPrimitiveKind(typeList2.item(i));
            if (primitiveItem1 != primitiveItem2) {
                if (primitiveItem1 == XSConstants.ANYSIMPLETYPE_DT && primitiveItem2 == XSConstants.STRING_DT ||
                    primitiveItem1 == XSConstants.STRING_DT && primitiveItem2 == XSConstants.ANYSIMPLETYPE_DT) {
                    continue;
                }
                return false;
            }
        }
    }
    return true;
}
 
Example #15
Source File: XSAttributeDecl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void setValues(String name, String targetNamespace,
        XSSimpleType simpleType, short constraintType, short scope,
        ValidatedInfo valInfo, XSComplexTypeDecl enclosingCT,
        XSObjectList annotations) {
    fName = name;
    fTargetNamespace = targetNamespace;
    fType = simpleType;
    fConstraintType = constraintType;
    fScope = scope;
    fDefault = valInfo;
    fEnclosingCT = enclosingCT;
    fAnnotations = annotations;
}
 
Example #16
Source File: XSSimpleTypeDecl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void checkExtraRules(ValidationContext context, ValidatedInfo validatedInfo) throws InvalidDatatypeValueException {

        Object ob = validatedInfo.actualValue;

        if (fVariety == VARIETY_ATOMIC) {

            fDVs[fValidationDV].checkExtraRules(ob, context);

        } else if (fVariety == VARIETY_LIST) {

            ListDV.ListData values = (ListDV.ListData)ob;
            XSSimpleType memberType = validatedInfo.memberType;
            int len = values.getLength();
            try {
                if (fItemType.fVariety == VARIETY_UNION) {
                    XSSimpleTypeDecl[] memberTypes = (XSSimpleTypeDecl[])validatedInfo.memberTypes;
                    for (int i = len-1; i >= 0; i--) {
                        validatedInfo.actualValue = values.item(i);
                        validatedInfo.memberType = memberTypes[i];
                        fItemType.checkExtraRules(context, validatedInfo);
                    }
                } else { // (fVariety == VARIETY_ATOMIC)
                    for (int i = len-1; i >= 0; i--) {
                        validatedInfo.actualValue = values.item(i);
                        fItemType.checkExtraRules(context, validatedInfo);
                    }
                }
            }
            finally {
                validatedInfo.actualValue = values;
                validatedInfo.memberType = memberType;
            }

        } else { // (fVariety == VARIETY_UNION)

            ((XSSimpleTypeDecl)validatedInfo.memberType).checkExtraRules(context, validatedInfo);

        }

    }
 
Example #17
Source File: XSAttributeDecl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void setValues(String name, String targetNamespace,
        XSSimpleType simpleType, short constraintType, short scope,
        ValidatedInfo valInfo, XSComplexTypeDecl enclosingCT,
        XSObjectList annotations) {
    fName = name;
    fTargetNamespace = targetNamespace;
    fType = simpleType;
    fConstraintType = constraintType;
    fScope = scope;
    fDefault = valInfo;
    fEnclosingCT = enclosingCT;
    fAnnotations = annotations;
}
 
Example #18
Source File: XMLSchemaValidator.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/** Returns true if the two ValidatedInfo objects can be compared in the same value space. **/
private boolean isComparable(ValidatedInfo info1, ValidatedInfo info2) {
    final short primitiveType1 = convertToPrimitiveKind(info1.actualValueType);
    final short primitiveType2 = convertToPrimitiveKind(info2.actualValueType);
    if (primitiveType1 != primitiveType2) {
        return (primitiveType1 == XSConstants.ANYSIMPLETYPE_DT && primitiveType2 == XSConstants.STRING_DT ||
                primitiveType1 == XSConstants.STRING_DT && primitiveType2 == XSConstants.ANYSIMPLETYPE_DT);
    }
    else if (primitiveType1 == XSConstants.LIST_DT || primitiveType1 == XSConstants.LISTOFUNION_DT) {
        final ShortList typeList1 = info1.itemValueTypes;
        final ShortList typeList2 = info2.itemValueTypes;
        final int typeList1Length = typeList1 != null ? typeList1.getLength() : 0;
        final int typeList2Length = typeList2 != null ? typeList2.getLength() : 0;
        if (typeList1Length != typeList2Length) {
            return false;
        }
        for (int i = 0; i < typeList1Length; ++i) {
            final short primitiveItem1 = convertToPrimitiveKind(typeList1.item(i));
            final short primitiveItem2 = convertToPrimitiveKind(typeList2.item(i));
            if (primitiveItem1 != primitiveItem2) {
                if (primitiveItem1 == XSConstants.ANYSIMPLETYPE_DT && primitiveItem2 == XSConstants.STRING_DT ||
                    primitiveItem1 == XSConstants.STRING_DT && primitiveItem2 == XSConstants.ANYSIMPLETYPE_DT) {
                    continue;
                }
                return false;
            }
        }
    }
    return true;
}
 
Example #19
Source File: XSAttributeDecl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public void setValues(String name, String targetNamespace,
        XSSimpleType simpleType, short constraintType, short scope,
        ValidatedInfo valInfo, XSComplexTypeDecl enclosingCT,
        XSObjectList annotations) {
    fName = name;
    fTargetNamespace = targetNamespace;
    fType = simpleType;
    fConstraintType = constraintType;
    fScope = scope;
    fDefault = valInfo;
    fEnclosingCT = enclosingCT;
    fAnnotations = annotations;
}
 
Example #20
Source File: XSSimpleTypeDecl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private void checkExtraRules(ValidationContext context, ValidatedInfo validatedInfo) throws InvalidDatatypeValueException {

        Object ob = validatedInfo.actualValue;

        if (fVariety == VARIETY_ATOMIC) {

            fDVs[fValidationDV].checkExtraRules(ob, context);

        } else if (fVariety == VARIETY_LIST) {

            ListDV.ListData values = (ListDV.ListData)ob;
            XSSimpleType memberType = validatedInfo.memberType;
            int len = values.getLength();
            try {
                if (fItemType.fVariety == VARIETY_UNION) {
                    XSSimpleTypeDecl[] memberTypes = (XSSimpleTypeDecl[])validatedInfo.memberTypes;
                    for (int i = len-1; i >= 0; i--) {
                        validatedInfo.actualValue = values.item(i);
                        validatedInfo.memberType = memberTypes[i];
                        fItemType.checkExtraRules(context, validatedInfo);
                    }
                } else { // (fVariety == VARIETY_ATOMIC)
                    for (int i = len-1; i >= 0; i--) {
                        validatedInfo.actualValue = values.item(i);
                        fItemType.checkExtraRules(context, validatedInfo);
                    }
                }
            }
            finally {
                validatedInfo.actualValue = values;
                validatedInfo.memberType = memberType;
            }

        } else { // (fVariety == VARIETY_UNION)

            ((XSSimpleTypeDecl)validatedInfo.memberType).checkExtraRules(context, validatedInfo);

        }

    }
 
Example #21
Source File: XSAttributeDecl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public void setValues(String name, String targetNamespace,
        XSSimpleType simpleType, short constraintType, short scope,
        ValidatedInfo valInfo, XSComplexTypeDecl enclosingCT,
        XSObjectList annotations) {
    fName = name;
    fTargetNamespace = targetNamespace;
    fType = simpleType;
    fConstraintType = constraintType;
    fScope = scope;
    fDefault = valInfo;
    fEnclosingCT = enclosingCT;
    fAnnotations = annotations;
}
 
Example #22
Source File: XSSimpleTypeDecl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private void checkExtraRules(ValidationContext context, ValidatedInfo validatedInfo) throws InvalidDatatypeValueException {

        Object ob = validatedInfo.actualValue;

        if (fVariety == VARIETY_ATOMIC) {

            fDVs[fValidationDV].checkExtraRules(ob, context);

        } else if (fVariety == VARIETY_LIST) {

            ListDV.ListData values = (ListDV.ListData)ob;
            XSSimpleType memberType = validatedInfo.memberType;
            int len = values.getLength();
            try {
                if (fItemType.fVariety == VARIETY_UNION) {
                    XSSimpleTypeDecl[] memberTypes = (XSSimpleTypeDecl[])validatedInfo.memberTypes;
                    for (int i = len-1; i >= 0; i--) {
                        validatedInfo.actualValue = values.item(i);
                        validatedInfo.memberType = memberTypes[i];
                        fItemType.checkExtraRules(context, validatedInfo);
                    }
                } else { // (fVariety == VARIETY_ATOMIC)
                    for (int i = len-1; i >= 0; i--) {
                        validatedInfo.actualValue = values.item(i);
                        fItemType.checkExtraRules(context, validatedInfo);
                    }
                }
            }
            finally {
                validatedInfo.actualValue = values;
                validatedInfo.memberType = memberType;
            }

        } else { // (fVariety == VARIETY_UNION)

            ((XSSimpleTypeDecl)validatedInfo.memberType).checkExtraRules(context, validatedInfo);

        }

    }
 
Example #23
Source File: XSSimpleTypeDecl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private void checkExtraRules(ValidationContext context, ValidatedInfo validatedInfo) throws InvalidDatatypeValueException {

        Object ob = validatedInfo.actualValue;

        if (fVariety == VARIETY_ATOMIC) {

            fDVs[fValidationDV].checkExtraRules(ob, context);

        } else if (fVariety == VARIETY_LIST) {

            ListDV.ListData values = (ListDV.ListData)ob;
            XSSimpleType memberType = validatedInfo.memberType;
            int len = values.getLength();
            try {
                if (fItemType.fVariety == VARIETY_UNION) {
                    XSSimpleTypeDecl[] memberTypes = (XSSimpleTypeDecl[])validatedInfo.memberTypes;
                    for (int i = len-1; i >= 0; i--) {
                        validatedInfo.actualValue = values.item(i);
                        validatedInfo.memberType = memberTypes[i];
                        fItemType.checkExtraRules(context, validatedInfo);
                    }
                } else { // (fVariety == VARIETY_ATOMIC)
                    for (int i = len-1; i >= 0; i--) {
                        validatedInfo.actualValue = values.item(i);
                        fItemType.checkExtraRules(context, validatedInfo);
                    }
                }
            }
            finally {
                validatedInfo.actualValue = values;
                validatedInfo.memberType = memberType;
            }

        } else { // (fVariety == VARIETY_UNION)

            ((XSSimpleTypeDecl)validatedInfo.memberType).checkExtraRules(context, validatedInfo);

        }

    }
 
Example #24
Source File: XMLSchemaValidator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/** Returns true if the two ValidatedInfo objects can be compared in the same value space. **/
private boolean isComparable(ValidatedInfo info1, ValidatedInfo info2) {
    final short primitiveType1 = convertToPrimitiveKind(info1.actualValueType);
    final short primitiveType2 = convertToPrimitiveKind(info2.actualValueType);
    if (primitiveType1 != primitiveType2) {
        return (primitiveType1 == XSConstants.ANYSIMPLETYPE_DT && primitiveType2 == XSConstants.STRING_DT ||
                primitiveType1 == XSConstants.STRING_DT && primitiveType2 == XSConstants.ANYSIMPLETYPE_DT);
    }
    else if (primitiveType1 == XSConstants.LIST_DT || primitiveType1 == XSConstants.LISTOFUNION_DT) {
        final ShortList typeList1 = info1.itemValueTypes;
        final ShortList typeList2 = info2.itemValueTypes;
        final int typeList1Length = typeList1 != null ? typeList1.getLength() : 0;
        final int typeList2Length = typeList2 != null ? typeList2.getLength() : 0;
        if (typeList1Length != typeList2Length) {
            return false;
        }
        for (int i = 0; i < typeList1Length; ++i) {
            final short primitiveItem1 = convertToPrimitiveKind(typeList1.item(i));
            final short primitiveItem2 = convertToPrimitiveKind(typeList2.item(i));
            if (primitiveItem1 != primitiveItem2) {
                if (primitiveItem1 == XSConstants.ANYSIMPLETYPE_DT && primitiveItem2 == XSConstants.STRING_DT ||
                    primitiveItem1 == XSConstants.STRING_DT && primitiveItem2 == XSConstants.ANYSIMPLETYPE_DT) {
                    continue;
                }
                return false;
            }
        }
    }
    return true;
}
 
Example #25
Source File: XSSimpleTypeDecl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void checkExtraRules(ValidationContext context, ValidatedInfo validatedInfo) throws InvalidDatatypeValueException {

        Object ob = validatedInfo.actualValue;

        if (fVariety == VARIETY_ATOMIC) {

            fDVs[fValidationDV].checkExtraRules(ob, context);

        } else if (fVariety == VARIETY_LIST) {

            ListDV.ListData values = (ListDV.ListData)ob;
            XSSimpleType memberType = validatedInfo.memberType;
            int len = values.getLength();
            try {
                if (fItemType.fVariety == VARIETY_UNION) {
                    XSSimpleTypeDecl[] memberTypes = (XSSimpleTypeDecl[])validatedInfo.memberTypes;
                    for (int i = len-1; i >= 0; i--) {
                        validatedInfo.actualValue = values.item(i);
                        validatedInfo.memberType = memberTypes[i];
                        fItemType.checkExtraRules(context, validatedInfo);
                    }
                } else { // (fVariety == VARIETY_ATOMIC)
                    for (int i = len-1; i >= 0; i--) {
                        validatedInfo.actualValue = values.item(i);
                        fItemType.checkExtraRules(context, validatedInfo);
                    }
                }
            }
            finally {
                validatedInfo.actualValue = values;
                validatedInfo.memberType = memberType;
            }

        } else { // (fVariety == VARIETY_UNION)

            ((XSSimpleTypeDecl)validatedInfo.memberType).checkExtraRules(context, validatedInfo);

        }

    }
 
Example #26
Source File: XSAttributeDecl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void setValues(String name, String targetNamespace,
        XSSimpleType simpleType, short constraintType, short scope,
        ValidatedInfo valInfo, XSComplexTypeDecl enclosingCT,
        XSObjectList annotations) {
    fName = name;
    fTargetNamespace = targetNamespace;
    fType = simpleType;
    fConstraintType = constraintType;
    fScope = scope;
    fDefault = valInfo;
    fEnclosingCT = enclosingCT;
    fAnnotations = annotations;
}
 
Example #27
Source File: XSAttributeDecl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void setValues(String name, String targetNamespace,
        XSSimpleType simpleType, short constraintType, short scope,
        ValidatedInfo valInfo, XSComplexTypeDecl enclosingCT,
        XSObjectList annotations) {
    fName = name;
    fTargetNamespace = targetNamespace;
    fType = simpleType;
    fConstraintType = constraintType;
    fScope = scope;
    fDefault = valInfo;
    fEnclosingCT = enclosingCT;
    fAnnotations = annotations;
}
 
Example #28
Source File: XMLSchemaValidator.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/** Returns true if the two ValidatedInfo objects can be compared in the same value space. **/
private boolean isComparable(ValidatedInfo info1, ValidatedInfo info2) {
    final short primitiveType1 = convertToPrimitiveKind(info1.actualValueType);
    final short primitiveType2 = convertToPrimitiveKind(info2.actualValueType);
    if (primitiveType1 != primitiveType2) {
        return (primitiveType1 == XSConstants.ANYSIMPLETYPE_DT && primitiveType2 == XSConstants.STRING_DT ||
                primitiveType1 == XSConstants.STRING_DT && primitiveType2 == XSConstants.ANYSIMPLETYPE_DT);
    }
    else if (primitiveType1 == XSConstants.LIST_DT || primitiveType1 == XSConstants.LISTOFUNION_DT) {
        final ShortList typeList1 = info1.itemValueTypes;
        final ShortList typeList2 = info2.itemValueTypes;
        final int typeList1Length = typeList1 != null ? typeList1.getLength() : 0;
        final int typeList2Length = typeList2 != null ? typeList2.getLength() : 0;
        if (typeList1Length != typeList2Length) {
            return false;
        }
        for (int i = 0; i < typeList1Length; ++i) {
            final short primitiveItem1 = convertToPrimitiveKind(typeList1.item(i));
            final short primitiveItem2 = convertToPrimitiveKind(typeList2.item(i));
            if (primitiveItem1 != primitiveItem2) {
                if (primitiveItem1 == XSConstants.ANYSIMPLETYPE_DT && primitiveItem2 == XSConstants.STRING_DT ||
                    primitiveItem1 == XSConstants.STRING_DT && primitiveItem2 == XSConstants.ANYSIMPLETYPE_DT) {
                    continue;
                }
                return false;
            }
        }
    }
    return true;
}
 
Example #29
Source File: XSSimpleTypeDecl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void checkExtraRules(ValidationContext context, ValidatedInfo validatedInfo) throws InvalidDatatypeValueException {

        Object ob = validatedInfo.actualValue;

        if (fVariety == VARIETY_ATOMIC) {

            fDVs[fValidationDV].checkExtraRules(ob, context);

        } else if (fVariety == VARIETY_LIST) {

            ListDV.ListData values = (ListDV.ListData)ob;
            XSSimpleType memberType = validatedInfo.memberType;
            int len = values.getLength();
            try {
                if (fItemType.fVariety == VARIETY_UNION) {
                    XSSimpleTypeDecl[] memberTypes = (XSSimpleTypeDecl[])validatedInfo.memberTypes;
                    for (int i = len-1; i >= 0; i--) {
                        validatedInfo.actualValue = values.item(i);
                        validatedInfo.memberType = memberTypes[i];
                        fItemType.checkExtraRules(context, validatedInfo);
                    }
                } else { // (fVariety == VARIETY_ATOMIC)
                    for (int i = len-1; i >= 0; i--) {
                        validatedInfo.actualValue = values.item(i);
                        fItemType.checkExtraRules(context, validatedInfo);
                    }
                }
            }
            finally {
                validatedInfo.actualValue = values;
                validatedInfo.memberType = memberType;
            }

        } else { // (fVariety == VARIETY_UNION)

            ((XSSimpleTypeDecl)validatedInfo.memberType).checkExtraRules(context, validatedInfo);

        }

    }
 
Example #30
Source File: XSAttributeDecl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public void setValues(String name, String targetNamespace,
        XSSimpleType simpleType, short constraintType, short scope,
        ValidatedInfo valInfo, XSComplexTypeDecl enclosingCT,
        XSObjectList annotations) {
    fName = name;
    fTargetNamespace = targetNamespace;
    fType = simpleType;
    fConstraintType = constraintType;
    fScope = scope;
    fDefault = valInfo;
    fEnclosingCT = enclosingCT;
    fAnnotations = annotations;
}