Java Code Examples for com.sun.org.apache.xerces.internal.xs.XSConstants#DERIVATION_NONE

The following examples show how to use com.sun.org.apache.xerces.internal.xs.XSConstants#DERIVATION_NONE . 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: XSElementDecl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
  * Reset current element declaration
  */
public void reset(){
    fScope = XSConstants.SCOPE_ABSENT;
    fName = null;
    fTargetNamespace = null;
    fType = null;
    fUnresolvedTypeName = null;
    fMiscFlags = 0;
    fBlock = XSConstants.DERIVATION_NONE;
    fFinal = XSConstants.DERIVATION_NONE;
    fDefault = null;
    fAnnotations = null;
    fSubGroup = null;
    // reset identity constraints
    for (int i=0;i<fIDCPos;i++) {
        fIDConstraints[i] = null;
    }

    fIDCPos = 0;
}
 
Example 2
Source File: XSElementDecl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
  * Reset current element declaration
  */
public void reset(){
    fScope = XSConstants.SCOPE_ABSENT;
    fName = null;
    fTargetNamespace = null;
    fType = null;
    fUnresolvedTypeName = null;
    fMiscFlags = 0;
    fBlock = XSConstants.DERIVATION_NONE;
    fFinal = XSConstants.DERIVATION_NONE;
    fDefault = null;
    fAnnotations = null;
    fSubGroup = null;
    // reset identity constraints
    for (int i=0;i<fIDCPos;i++) {
        fIDConstraints[i] = null;
    }

    fIDCPos = 0;
}
 
Example 3
Source File: XSElementDecl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
  * Reset current element declaration
  */
public void reset(){
    fScope = XSConstants.SCOPE_ABSENT;
    fName = null;
    fTargetNamespace = null;
    fType = null;
    fUnresolvedTypeName = null;
    fMiscFlags = 0;
    fBlock = XSConstants.DERIVATION_NONE;
    fFinal = XSConstants.DERIVATION_NONE;
    fDefault = null;
    fAnnotations = null;
    fSubGroup = null;
    // reset identity constraints
    for (int i=0;i<fIDCPos;i++) {
        fIDConstraints[i] = null;
    }

    fIDCPos = 0;
}
 
Example 4
Source File: XSElementDecl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
  * Reset current element declaration
  */
public void reset(){
    fScope = XSConstants.SCOPE_ABSENT;
    fName = null;
    fTargetNamespace = null;
    fType = null;
    fUnresolvedTypeName = null;
    fMiscFlags = 0;
    fBlock = XSConstants.DERIVATION_NONE;
    fFinal = XSConstants.DERIVATION_NONE;
    fDefault = null;
    fAnnotations = null;
    fSubGroup = null;
    // reset identity constraints
    for (int i=0;i<fIDCPos;i++) {
        fIDConstraints[i] = null;
    }

    fIDCPos = 0;
}
 
Example 5
Source File: XSElementDecl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
  * Reset current element declaration
  */
public void reset(){
    fScope = XSConstants.SCOPE_ABSENT;
    fName = null;
    fTargetNamespace = null;
    fType = null;
    fUnresolvedTypeName = null;
    fMiscFlags = 0;
    fBlock = XSConstants.DERIVATION_NONE;
    fFinal = XSConstants.DERIVATION_NONE;
    fDefault = null;
    fAnnotations = null;
    fSubGroup = null;
    // reset identity constraints
    for (int i=0;i<fIDCPos;i++) {
        fIDConstraints[i] = null;
    }

    fIDCPos = 0;
}
 
Example 6
Source File: XSElementDecl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
  * Reset current element declaration
  */
public void reset(){
    fScope = XSConstants.SCOPE_ABSENT;
    fName = null;
    fTargetNamespace = null;
    fType = null;
    fUnresolvedTypeName = null;
    fMiscFlags = 0;
    fBlock = XSConstants.DERIVATION_NONE;
    fFinal = XSConstants.DERIVATION_NONE;
    fDefault = null;
    fAnnotations = null;
    fSubGroup = null;
    // reset identity constraints
    for (int i=0;i<fIDCPos;i++) {
        fIDConstraints[i] = null;
    }

    fIDCPos = 0;
}
 
Example 7
Source File: XSElementDecl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
  * Reset current element declaration
  */
public void reset(){
    fScope = XSConstants.SCOPE_ABSENT;
    fName = null;
    fTargetNamespace = null;
    fType = null;
    fUnresolvedTypeName = null;
    fMiscFlags = 0;
    fBlock = XSConstants.DERIVATION_NONE;
    fFinal = XSConstants.DERIVATION_NONE;
    fDefault = null;
    fAnnotations = null;
    fSubGroup = null;
    // reset identity constraints
    for (int i=0;i<fIDCPos;i++) {
        fIDConstraints[i] = null;
    }

    fIDCPos = 0;
}
 
Example 8
Source File: XSElementDecl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
  * Reset current element declaration
  */
public void reset(){
    fScope = XSConstants.SCOPE_ABSENT;
    fName = null;
    fTargetNamespace = null;
    fType = null;
    fUnresolvedTypeName = null;
    fMiscFlags = 0;
    fBlock = XSConstants.DERIVATION_NONE;
    fFinal = XSConstants.DERIVATION_NONE;
    fDefault = null;
    fAnnotations = null;
    fSubGroup = null;
    // reset identity constraints
    for (int i=0;i<fIDCPos;i++) {
        fIDConstraints[i] = null;
    }

    fIDCPos = 0;
}
 
Example 9
Source File: XSElementDecl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
  * Reset current element declaration
  */
public void reset(){
    fScope = XSConstants.SCOPE_ABSENT;
    fName = null;
    fTargetNamespace = null;
    fType = null;
    fUnresolvedTypeName = null;
    fMiscFlags = 0;
    fBlock = XSConstants.DERIVATION_NONE;
    fFinal = XSConstants.DERIVATION_NONE;
    fDefault = null;
    fAnnotations = null;
    fSubGroup = null;
    // reset identity constraints
    for (int i=0;i<fIDCPos;i++) {
        fIDConstraints[i] = null;
    }

    fIDCPos = 0;
}
 
Example 10
Source File: XSConstraints.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
private static void checkNameAndTypeOK(XSElementDecl dElement, int dMin, int dMax,
        XSElementDecl bElement, int bMin, int bMax)
    throws XMLSchemaException {


    //
    // Check that the names are the same
    //
    if (dElement.fName != bElement.fName ||
            dElement.fTargetNamespace != bElement.fTargetNamespace) {
        throw new XMLSchemaException(
                "rcase-NameAndTypeOK.1",new Object[]{dElement.fName,
                        dElement.fTargetNamespace, bElement.fName, bElement.fTargetNamespace});
    }

    //
    // Check nillable
    //
    if (!bElement.getNillable() && dElement.getNillable()) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.2",
                new Object[]{dElement.fName});
    }

    //
    // Check occurrence range
    //
    if (!checkOccurrenceRange(dMin, dMax, bMin, bMax)) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.3",
                new Object[]{
                dElement.fName,
                Integer.toString(dMin),
                dMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(dMax),
                        Integer.toString(bMin),
                        bMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(bMax)});
    }

    //
    // Check for consistent fixed values
    //
    if (bElement.getConstraintType() == XSConstants.VC_FIXED) {
        // derived one has to have a fixed value
        if (dElement.getConstraintType() != XSConstants.VC_FIXED) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.a",
                    new Object[]{dElement.fName, bElement.fDefault.stringValue()});
        }

        // get simple type
        boolean isSimple = false;
        if (dElement.fType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE ||
                ((XSComplexTypeDecl)dElement.fType).fContentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE) {
            isSimple = true;
        }

        // if there is no simple type, then compare based on string
        if (!isSimple && !bElement.fDefault.normalizedValue.equals(dElement.fDefault.normalizedValue) ||
                isSimple && !bElement.fDefault.actualValue.equals(dElement.fDefault.actualValue)) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.b",
                    new Object[]{dElement.fName,
                    dElement.fDefault.stringValue(),
                    bElement.fDefault.stringValue()});
        }
    }

    //
    // Check identity constraints
    //
    checkIDConstraintRestriction(dElement, bElement);

    //
    // Check for disallowed substitutions
    //
    int blockSet1 = dElement.fBlock;
    int blockSet2 = bElement.fBlock;
    if (((blockSet1 & blockSet2)!=blockSet2) ||
            (blockSet1==XSConstants.DERIVATION_NONE && blockSet2!=XSConstants.DERIVATION_NONE))
        throw new XMLSchemaException("rcase-NameAndTypeOK.6",
                new Object[]{dElement.fName});


    //
    // Check that the derived element's type is derived from the base's.
    //
    if (!checkTypeDerivationOk(dElement.fType, bElement.fType,
            (short)(XSConstants.DERIVATION_EXTENSION|XSConstants.DERIVATION_LIST|XSConstants.DERIVATION_UNION))) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.7",
                new Object[]{dElement.fName, dElement.fType.getName(), bElement.fType.getName()});
    }

}
 
Example 11
Source File: XSConstraints.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private static void checkNameAndTypeOK(XSElementDecl dElement, int dMin, int dMax,
        XSElementDecl bElement, int bMin, int bMax)
    throws XMLSchemaException {


    //
    // Check that the names are the same
    //
    if (dElement.fName != bElement.fName ||
            dElement.fTargetNamespace != bElement.fTargetNamespace) {
        throw new XMLSchemaException(
                "rcase-NameAndTypeOK.1",new Object[]{dElement.fName,
                        dElement.fTargetNamespace, bElement.fName, bElement.fTargetNamespace});
    }

    //
    // Check nillable
    //
    if (!bElement.getNillable() && dElement.getNillable()) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.2",
                new Object[]{dElement.fName});
    }

    //
    // Check occurrence range
    //
    if (!checkOccurrenceRange(dMin, dMax, bMin, bMax)) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.3",
                new Object[]{
                dElement.fName,
                Integer.toString(dMin),
                dMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(dMax),
                        Integer.toString(bMin),
                        bMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(bMax)});
    }

    //
    // Check for consistent fixed values
    //
    if (bElement.getConstraintType() == XSConstants.VC_FIXED) {
        // derived one has to have a fixed value
        if (dElement.getConstraintType() != XSConstants.VC_FIXED) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.a",
                    new Object[]{dElement.fName, bElement.fDefault.stringValue()});
        }

        // get simple type
        boolean isSimple = false;
        if (dElement.fType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE ||
                ((XSComplexTypeDecl)dElement.fType).fContentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE) {
            isSimple = true;
        }

        // if there is no simple type, then compare based on string
        if (!isSimple && !bElement.fDefault.normalizedValue.equals(dElement.fDefault.normalizedValue) ||
                isSimple && !bElement.fDefault.actualValue.equals(dElement.fDefault.actualValue)) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.b",
                    new Object[]{dElement.fName,
                    dElement.fDefault.stringValue(),
                    bElement.fDefault.stringValue()});
        }
    }

    //
    // Check identity constraints
    //
    checkIDConstraintRestriction(dElement, bElement);

    //
    // Check for disallowed substitutions
    //
    int blockSet1 = dElement.fBlock;
    int blockSet2 = bElement.fBlock;
    if (((blockSet1 & blockSet2)!=blockSet2) ||
            (blockSet1==XSConstants.DERIVATION_NONE && blockSet2!=XSConstants.DERIVATION_NONE))
        throw new XMLSchemaException("rcase-NameAndTypeOK.6",
                new Object[]{dElement.fName});


    //
    // Check that the derived element's type is derived from the base's.
    //
    if (!checkTypeDerivationOk(dElement.fType, bElement.fType,
            (short)(XSConstants.DERIVATION_EXTENSION|XSConstants.DERIVATION_LIST|XSConstants.DERIVATION_UNION))) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.7",
                new Object[]{dElement.fName, dElement.fType.getName(), bElement.fType.getName()});
    }

}
 
Example 12
Source File: XSConstraints.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private static void checkNameAndTypeOK(XSElementDecl dElement, int dMin, int dMax,
        XSElementDecl bElement, int bMin, int bMax)
    throws XMLSchemaException {


    //
    // Check that the names are the same
    //
    if (dElement.fName != bElement.fName ||
            dElement.fTargetNamespace != bElement.fTargetNamespace) {
        throw new XMLSchemaException(
                "rcase-NameAndTypeOK.1",new Object[]{dElement.fName,
                        dElement.fTargetNamespace, bElement.fName, bElement.fTargetNamespace});
    }

    //
    // Check nillable
    //
    if (!bElement.getNillable() && dElement.getNillable()) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.2",
                new Object[]{dElement.fName});
    }

    //
    // Check occurrence range
    //
    if (!checkOccurrenceRange(dMin, dMax, bMin, bMax)) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.3",
                new Object[]{
                dElement.fName,
                Integer.toString(dMin),
                dMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(dMax),
                        Integer.toString(bMin),
                        bMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(bMax)});
    }

    //
    // Check for consistent fixed values
    //
    if (bElement.getConstraintType() == XSConstants.VC_FIXED) {
        // derived one has to have a fixed value
        if (dElement.getConstraintType() != XSConstants.VC_FIXED) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.a",
                    new Object[]{dElement.fName, bElement.fDefault.stringValue()});
        }

        // get simple type
        boolean isSimple = false;
        if (dElement.fType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE ||
                ((XSComplexTypeDecl)dElement.fType).fContentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE) {
            isSimple = true;
        }

        // if there is no simple type, then compare based on string
        if (!isSimple && !bElement.fDefault.normalizedValue.equals(dElement.fDefault.normalizedValue) ||
                isSimple && !bElement.fDefault.actualValue.equals(dElement.fDefault.actualValue)) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.b",
                    new Object[]{dElement.fName,
                    dElement.fDefault.stringValue(),
                    bElement.fDefault.stringValue()});
        }
    }

    //
    // Check identity constraints
    //
    checkIDConstraintRestriction(dElement, bElement);

    //
    // Check for disallowed substitutions
    //
    int blockSet1 = dElement.fBlock;
    int blockSet2 = bElement.fBlock;
    if (((blockSet1 & blockSet2)!=blockSet2) ||
            (blockSet1==XSConstants.DERIVATION_NONE && blockSet2!=XSConstants.DERIVATION_NONE))
        throw new XMLSchemaException("rcase-NameAndTypeOK.6",
                new Object[]{dElement.fName});


    //
    // Check that the derived element's type is derived from the base's.
    //
    if (!checkTypeDerivationOk(dElement.fType, bElement.fType,
            (short)(XSConstants.DERIVATION_EXTENSION|XSConstants.DERIVATION_LIST|XSConstants.DERIVATION_UNION))) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.7",
                new Object[]{dElement.fName, dElement.fType.getName(), bElement.fType.getName()});
    }

}
 
Example 13
Source File: XSConstraints.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private static void checkNameAndTypeOK(XSElementDecl dElement, int dMin, int dMax,
        XSElementDecl bElement, int bMin, int bMax)
    throws XMLSchemaException {


    //
    // Check that the names are the same
    //
    if (dElement.fName != bElement.fName ||
            dElement.fTargetNamespace != bElement.fTargetNamespace) {
        throw new XMLSchemaException(
                "rcase-NameAndTypeOK.1",new Object[]{dElement.fName,
                        dElement.fTargetNamespace, bElement.fName, bElement.fTargetNamespace});
    }

    //
    // Check nillable
    //
    if (!bElement.getNillable() && dElement.getNillable()) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.2",
                new Object[]{dElement.fName});
    }

    //
    // Check occurrence range
    //
    if (!checkOccurrenceRange(dMin, dMax, bMin, bMax)) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.3",
                new Object[]{
                dElement.fName,
                Integer.toString(dMin),
                dMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(dMax),
                        Integer.toString(bMin),
                        bMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(bMax)});
    }

    //
    // Check for consistent fixed values
    //
    if (bElement.getConstraintType() == XSConstants.VC_FIXED) {
        // derived one has to have a fixed value
        if (dElement.getConstraintType() != XSConstants.VC_FIXED) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.a",
                    new Object[]{dElement.fName, bElement.fDefault.stringValue()});
        }

        // get simple type
        boolean isSimple = false;
        if (dElement.fType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE ||
                ((XSComplexTypeDecl)dElement.fType).fContentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE) {
            isSimple = true;
        }

        // if there is no simple type, then compare based on string
        if (!isSimple && !bElement.fDefault.normalizedValue.equals(dElement.fDefault.normalizedValue) ||
                isSimple && !bElement.fDefault.actualValue.equals(dElement.fDefault.actualValue)) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.b",
                    new Object[]{dElement.fName,
                    dElement.fDefault.stringValue(),
                    bElement.fDefault.stringValue()});
        }
    }

    //
    // Check identity constraints
    //
    checkIDConstraintRestriction(dElement, bElement);

    //
    // Check for disallowed substitutions
    //
    int blockSet1 = dElement.fBlock;
    int blockSet2 = bElement.fBlock;
    if (((blockSet1 & blockSet2)!=blockSet2) ||
            (blockSet1==XSConstants.DERIVATION_NONE && blockSet2!=XSConstants.DERIVATION_NONE))
        throw new XMLSchemaException("rcase-NameAndTypeOK.6",
                new Object[]{dElement.fName});


    //
    // Check that the derived element's type is derived from the base's.
    //
    if (!checkTypeDerivationOk(dElement.fType, bElement.fType,
            (short)(XSConstants.DERIVATION_EXTENSION|XSConstants.DERIVATION_LIST|XSConstants.DERIVATION_UNION))) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.7",
                new Object[]{dElement.fName, dElement.fType.getName(), bElement.fType.getName()});
    }

}
 
Example 14
Source File: XSConstraints.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
private static void checkNameAndTypeOK(XSElementDecl dElement, int dMin, int dMax,
        XSElementDecl bElement, int bMin, int bMax)
    throws XMLSchemaException {


    //
    // Check that the names are the same
    //
    if (dElement.fName != bElement.fName ||
            dElement.fTargetNamespace != bElement.fTargetNamespace) {
        throw new XMLSchemaException(
                "rcase-NameAndTypeOK.1",new Object[]{dElement.fName,
                        dElement.fTargetNamespace, bElement.fName, bElement.fTargetNamespace});
    }

    //
    // Check nillable
    //
    if (!bElement.getNillable() && dElement.getNillable()) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.2",
                new Object[]{dElement.fName});
    }

    //
    // Check occurrence range
    //
    if (!checkOccurrenceRange(dMin, dMax, bMin, bMax)) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.3",
                new Object[]{
                dElement.fName,
                Integer.toString(dMin),
                dMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(dMax),
                        Integer.toString(bMin),
                        bMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(bMax)});
    }

    //
    // Check for consistent fixed values
    //
    if (bElement.getConstraintType() == XSConstants.VC_FIXED) {
        // derived one has to have a fixed value
        if (dElement.getConstraintType() != XSConstants.VC_FIXED) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.a",
                    new Object[]{dElement.fName, bElement.fDefault.stringValue()});
        }

        // get simple type
        boolean isSimple = false;
        if (dElement.fType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE ||
                ((XSComplexTypeDecl)dElement.fType).fContentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE) {
            isSimple = true;
        }

        // if there is no simple type, then compare based on string
        if (!isSimple && !bElement.fDefault.normalizedValue.equals(dElement.fDefault.normalizedValue) ||
                isSimple && !bElement.fDefault.actualValue.equals(dElement.fDefault.actualValue)) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.b",
                    new Object[]{dElement.fName,
                    dElement.fDefault.stringValue(),
                    bElement.fDefault.stringValue()});
        }
    }

    //
    // Check identity constraints
    //
    checkIDConstraintRestriction(dElement, bElement);

    //
    // Check for disallowed substitutions
    //
    int blockSet1 = dElement.fBlock;
    int blockSet2 = bElement.fBlock;
    if (((blockSet1 & blockSet2)!=blockSet2) ||
            (blockSet1==XSConstants.DERIVATION_NONE && blockSet2!=XSConstants.DERIVATION_NONE))
        throw new XMLSchemaException("rcase-NameAndTypeOK.6",
                new Object[]{dElement.fName});


    //
    // Check that the derived element's type is derived from the base's.
    //
    if (!checkTypeDerivationOk(dElement.fType, bElement.fType,
            (short)(XSConstants.DERIVATION_EXTENSION|XSConstants.DERIVATION_LIST|XSConstants.DERIVATION_UNION))) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.7",
                new Object[]{dElement.fName, dElement.fType.getName(), bElement.fType.getName()});
    }

}
 
Example 15
Source File: XSConstraints.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private static void checkNameAndTypeOK(XSElementDecl dElement, int dMin, int dMax,
        XSElementDecl bElement, int bMin, int bMax)
    throws XMLSchemaException {


    //
    // Check that the names are the same
    //
    if (dElement.fName != bElement.fName ||
            dElement.fTargetNamespace != bElement.fTargetNamespace) {
        throw new XMLSchemaException(
                "rcase-NameAndTypeOK.1",new Object[]{dElement.fName,
                        dElement.fTargetNamespace, bElement.fName, bElement.fTargetNamespace});
    }

    //
    // Check nillable
    //
    if (!bElement.getNillable() && dElement.getNillable()) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.2",
                new Object[]{dElement.fName});
    }

    //
    // Check occurrence range
    //
    if (!checkOccurrenceRange(dMin, dMax, bMin, bMax)) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.3",
                new Object[]{
                dElement.fName,
                Integer.toString(dMin),
                dMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(dMax),
                        Integer.toString(bMin),
                        bMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(bMax)});
    }

    //
    // Check for consistent fixed values
    //
    if (bElement.getConstraintType() == XSConstants.VC_FIXED) {
        // derived one has to have a fixed value
        if (dElement.getConstraintType() != XSConstants.VC_FIXED) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.a",
                    new Object[]{dElement.fName, bElement.fDefault.stringValue()});
        }

        // get simple type
        boolean isSimple = false;
        if (dElement.fType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE ||
                ((XSComplexTypeDecl)dElement.fType).fContentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE) {
            isSimple = true;
        }

        // if there is no simple type, then compare based on string
        if (!isSimple && !bElement.fDefault.normalizedValue.equals(dElement.fDefault.normalizedValue) ||
                isSimple && !bElement.fDefault.actualValue.equals(dElement.fDefault.actualValue)) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.b",
                    new Object[]{dElement.fName,
                    dElement.fDefault.stringValue(),
                    bElement.fDefault.stringValue()});
        }
    }

    //
    // Check identity constraints
    //
    checkIDConstraintRestriction(dElement, bElement);

    //
    // Check for disallowed substitutions
    //
    int blockSet1 = dElement.fBlock;
    int blockSet2 = bElement.fBlock;
    if (((blockSet1 & blockSet2)!=blockSet2) ||
            (blockSet1==XSConstants.DERIVATION_NONE && blockSet2!=XSConstants.DERIVATION_NONE))
        throw new XMLSchemaException("rcase-NameAndTypeOK.6",
                new Object[]{dElement.fName});


    //
    // Check that the derived element's type is derived from the base's.
    //
    if (!checkTypeDerivationOk(dElement.fType, bElement.fType,
            (short)(XSConstants.DERIVATION_EXTENSION|XSConstants.DERIVATION_LIST|XSConstants.DERIVATION_UNION))) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.7",
                new Object[]{dElement.fName, dElement.fType.getName(), bElement.fType.getName()});
    }

}
 
Example 16
Source File: XSConstraints.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private static void checkNameAndTypeOK(XSElementDecl dElement, int dMin, int dMax,
        XSElementDecl bElement, int bMin, int bMax)
    throws XMLSchemaException {


    //
    // Check that the names are the same
    //
    if (dElement.fName != bElement.fName ||
            dElement.fTargetNamespace != bElement.fTargetNamespace) {
        throw new XMLSchemaException(
                "rcase-NameAndTypeOK.1",new Object[]{dElement.fName,
                        dElement.fTargetNamespace, bElement.fName, bElement.fTargetNamespace});
    }

    //
    // Check nillable
    //
    if (!bElement.getNillable() && dElement.getNillable()) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.2",
                new Object[]{dElement.fName});
    }

    //
    // Check occurrence range
    //
    if (!checkOccurrenceRange(dMin, dMax, bMin, bMax)) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.3",
                new Object[]{
                dElement.fName,
                Integer.toString(dMin),
                dMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(dMax),
                        Integer.toString(bMin),
                        bMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(bMax)});
    }

    //
    // Check for consistent fixed values
    //
    if (bElement.getConstraintType() == XSConstants.VC_FIXED) {
        // derived one has to have a fixed value
        if (dElement.getConstraintType() != XSConstants.VC_FIXED) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.a",
                    new Object[]{dElement.fName, bElement.fDefault.stringValue()});
        }

        // get simple type
        boolean isSimple = false;
        if (dElement.fType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE ||
                ((XSComplexTypeDecl)dElement.fType).fContentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE) {
            isSimple = true;
        }

        // if there is no simple type, then compare based on string
        if (!isSimple && !bElement.fDefault.normalizedValue.equals(dElement.fDefault.normalizedValue) ||
                isSimple && !bElement.fDefault.actualValue.equals(dElement.fDefault.actualValue)) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.b",
                    new Object[]{dElement.fName,
                    dElement.fDefault.stringValue(),
                    bElement.fDefault.stringValue()});
        }
    }

    //
    // Check identity constraints
    //
    checkIDConstraintRestriction(dElement, bElement);

    //
    // Check for disallowed substitutions
    //
    int blockSet1 = dElement.fBlock;
    int blockSet2 = bElement.fBlock;
    if (((blockSet1 & blockSet2)!=blockSet2) ||
            (blockSet1==XSConstants.DERIVATION_NONE && blockSet2!=XSConstants.DERIVATION_NONE))
        throw new XMLSchemaException("rcase-NameAndTypeOK.6",
                new Object[]{dElement.fName});


    //
    // Check that the derived element's type is derived from the base's.
    //
    if (!checkTypeDerivationOk(dElement.fType, bElement.fType,
            (short)(XSConstants.DERIVATION_EXTENSION|XSConstants.DERIVATION_LIST|XSConstants.DERIVATION_UNION))) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.7",
                new Object[]{dElement.fName, dElement.fType.getName(), bElement.fType.getName()});
    }

}
 
Example 17
Source File: XSConstraints.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private static void checkNameAndTypeOK(XSElementDecl dElement, int dMin, int dMax,
        XSElementDecl bElement, int bMin, int bMax)
    throws XMLSchemaException {


    //
    // Check that the names are the same
    //
    if (dElement.fName != bElement.fName ||
            dElement.fTargetNamespace != bElement.fTargetNamespace) {
        throw new XMLSchemaException(
                "rcase-NameAndTypeOK.1",new Object[]{dElement.fName,
                        dElement.fTargetNamespace, bElement.fName, bElement.fTargetNamespace});
    }

    //
    // Check nillable
    //
    if (!bElement.getNillable() && dElement.getNillable()) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.2",
                new Object[]{dElement.fName});
    }

    //
    // Check occurrence range
    //
    if (!checkOccurrenceRange(dMin, dMax, bMin, bMax)) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.3",
                new Object[]{
                dElement.fName,
                Integer.toString(dMin),
                dMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(dMax),
                        Integer.toString(bMin),
                        bMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(bMax)});
    }

    //
    // Check for consistent fixed values
    //
    if (bElement.getConstraintType() == XSConstants.VC_FIXED) {
        // derived one has to have a fixed value
        if (dElement.getConstraintType() != XSConstants.VC_FIXED) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.a",
                    new Object[]{dElement.fName, bElement.fDefault.stringValue()});
        }

        // get simple type
        boolean isSimple = false;
        if (dElement.fType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE ||
                ((XSComplexTypeDecl)dElement.fType).fContentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE) {
            isSimple = true;
        }

        // if there is no simple type, then compare based on string
        if (!isSimple && !bElement.fDefault.normalizedValue.equals(dElement.fDefault.normalizedValue) ||
                isSimple && !bElement.fDefault.actualValue.equals(dElement.fDefault.actualValue)) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.b",
                    new Object[]{dElement.fName,
                    dElement.fDefault.stringValue(),
                    bElement.fDefault.stringValue()});
        }
    }

    //
    // Check identity constraints
    //
    checkIDConstraintRestriction(dElement, bElement);

    //
    // Check for disallowed substitutions
    //
    int blockSet1 = dElement.fBlock;
    int blockSet2 = bElement.fBlock;
    if (((blockSet1 & blockSet2)!=blockSet2) ||
            (blockSet1==XSConstants.DERIVATION_NONE && blockSet2!=XSConstants.DERIVATION_NONE))
        throw new XMLSchemaException("rcase-NameAndTypeOK.6",
                new Object[]{dElement.fName});


    //
    // Check that the derived element's type is derived from the base's.
    //
    if (!checkTypeDerivationOk(dElement.fType, bElement.fType,
            (short)(XSConstants.DERIVATION_EXTENSION|XSConstants.DERIVATION_LIST|XSConstants.DERIVATION_UNION))) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.7",
                new Object[]{dElement.fName, dElement.fType.getName(), bElement.fType.getName()});
    }

}
 
Example 18
Source File: XSConstraints.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private static void checkNameAndTypeOK(XSElementDecl dElement, int dMin, int dMax,
        XSElementDecl bElement, int bMin, int bMax)
    throws XMLSchemaException {


    //
    // Check that the names are the same
    //
    if (dElement.fName != bElement.fName ||
            dElement.fTargetNamespace != bElement.fTargetNamespace) {
        throw new XMLSchemaException(
                "rcase-NameAndTypeOK.1",new Object[]{dElement.fName,
                        dElement.fTargetNamespace, bElement.fName, bElement.fTargetNamespace});
    }

    //
    // Check nillable
    //
    if (!bElement.getNillable() && dElement.getNillable()) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.2",
                new Object[]{dElement.fName});
    }

    //
    // Check occurrence range
    //
    if (!checkOccurrenceRange(dMin, dMax, bMin, bMax)) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.3",
                new Object[]{
                dElement.fName,
                Integer.toString(dMin),
                dMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(dMax),
                        Integer.toString(bMin),
                        bMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(bMax)});
    }

    //
    // Check for consistent fixed values
    //
    if (bElement.getConstraintType() == XSConstants.VC_FIXED) {
        // derived one has to have a fixed value
        if (dElement.getConstraintType() != XSConstants.VC_FIXED) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.a",
                    new Object[]{dElement.fName, bElement.fDefault.stringValue()});
        }

        // get simple type
        boolean isSimple = false;
        if (dElement.fType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE ||
                ((XSComplexTypeDecl)dElement.fType).fContentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE) {
            isSimple = true;
        }

        // if there is no simple type, then compare based on string
        if (!isSimple && !bElement.fDefault.normalizedValue.equals(dElement.fDefault.normalizedValue) ||
                isSimple && !bElement.fDefault.actualValue.equals(dElement.fDefault.actualValue)) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.b",
                    new Object[]{dElement.fName,
                    dElement.fDefault.stringValue(),
                    bElement.fDefault.stringValue()});
        }
    }

    //
    // Check identity constraints
    //
    checkIDConstraintRestriction(dElement, bElement);

    //
    // Check for disallowed substitutions
    //
    int blockSet1 = dElement.fBlock;
    int blockSet2 = bElement.fBlock;
    if (((blockSet1 & blockSet2)!=blockSet2) ||
            (blockSet1==XSConstants.DERIVATION_NONE && blockSet2!=XSConstants.DERIVATION_NONE))
        throw new XMLSchemaException("rcase-NameAndTypeOK.6",
                new Object[]{dElement.fName});


    //
    // Check that the derived element's type is derived from the base's.
    //
    if (!checkTypeDerivationOk(dElement.fType, bElement.fType,
            (short)(XSConstants.DERIVATION_EXTENSION|XSConstants.DERIVATION_LIST|XSConstants.DERIVATION_UNION))) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.7",
                new Object[]{dElement.fName, dElement.fType.getName(), bElement.fType.getName()});
    }

}
 
Example 19
Source File: XSConstraints.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private static void checkNameAndTypeOK(XSElementDecl dElement, int dMin, int dMax,
        XSElementDecl bElement, int bMin, int bMax)
    throws XMLSchemaException {


    //
    // Check that the names are the same
    //
    if (dElement.fName != bElement.fName ||
            dElement.fTargetNamespace != bElement.fTargetNamespace) {
        throw new XMLSchemaException(
                "rcase-NameAndTypeOK.1",new Object[]{dElement.fName,
                        dElement.fTargetNamespace, bElement.fName, bElement.fTargetNamespace});
    }

    //
    // Check nillable
    //
    if (!bElement.getNillable() && dElement.getNillable()) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.2",
                new Object[]{dElement.fName});
    }

    //
    // Check occurrence range
    //
    if (!checkOccurrenceRange(dMin, dMax, bMin, bMax)) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.3",
                new Object[]{
                dElement.fName,
                Integer.toString(dMin),
                dMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(dMax),
                        Integer.toString(bMin),
                        bMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(bMax)});
    }

    //
    // Check for consistent fixed values
    //
    if (bElement.getConstraintType() == XSConstants.VC_FIXED) {
        // derived one has to have a fixed value
        if (dElement.getConstraintType() != XSConstants.VC_FIXED) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.a",
                    new Object[]{dElement.fName, bElement.fDefault.stringValue()});
        }

        // get simple type
        boolean isSimple = false;
        if (dElement.fType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE ||
                ((XSComplexTypeDecl)dElement.fType).fContentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE) {
            isSimple = true;
        }

        // if there is no simple type, then compare based on string
        if (!isSimple && !bElement.fDefault.normalizedValue.equals(dElement.fDefault.normalizedValue) ||
                isSimple && !bElement.fDefault.actualValue.equals(dElement.fDefault.actualValue)) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.b",
                    new Object[]{dElement.fName,
                    dElement.fDefault.stringValue(),
                    bElement.fDefault.stringValue()});
        }
    }

    //
    // Check identity constraints
    //
    checkIDConstraintRestriction(dElement, bElement);

    //
    // Check for disallowed substitutions
    //
    int blockSet1 = dElement.fBlock;
    int blockSet2 = bElement.fBlock;
    if (((blockSet1 & blockSet2)!=blockSet2) ||
            (blockSet1==XSConstants.DERIVATION_NONE && blockSet2!=XSConstants.DERIVATION_NONE))
        throw new XMLSchemaException("rcase-NameAndTypeOK.6",
                new Object[]{dElement.fName});


    //
    // Check that the derived element's type is derived from the base's.
    //
    if (!checkTypeDerivationOk(dElement.fType, bElement.fType,
            (short)(XSConstants.DERIVATION_EXTENSION|XSConstants.DERIVATION_LIST|XSConstants.DERIVATION_UNION))) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.7",
                new Object[]{dElement.fName, dElement.fType.getName(), bElement.fType.getName()});
    }

}
 
Example 20
Source File: XSConstraints.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
private static void checkNameAndTypeOK(XSElementDecl dElement, int dMin, int dMax,
        XSElementDecl bElement, int bMin, int bMax)
    throws XMLSchemaException {


    //
    // Check that the names are the same
    //
    if (dElement.fName != bElement.fName ||
            dElement.fTargetNamespace != bElement.fTargetNamespace) {
        throw new XMLSchemaException(
                "rcase-NameAndTypeOK.1",new Object[]{dElement.fName,
                        dElement.fTargetNamespace, bElement.fName, bElement.fTargetNamespace});
    }

    //
    // Check nillable
    //
    if (!bElement.getNillable() && dElement.getNillable()) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.2",
                new Object[]{dElement.fName});
    }

    //
    // Check occurrence range
    //
    if (!checkOccurrenceRange(dMin, dMax, bMin, bMax)) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.3",
                new Object[]{
                dElement.fName,
                Integer.toString(dMin),
                dMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(dMax),
                        Integer.toString(bMin),
                        bMax==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(bMax)});
    }

    //
    // Check for consistent fixed values
    //
    if (bElement.getConstraintType() == XSConstants.VC_FIXED) {
        // derived one has to have a fixed value
        if (dElement.getConstraintType() != XSConstants.VC_FIXED) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.a",
                    new Object[]{dElement.fName, bElement.fDefault.stringValue()});
        }

        // get simple type
        boolean isSimple = false;
        if (dElement.fType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE ||
                ((XSComplexTypeDecl)dElement.fType).fContentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE) {
            isSimple = true;
        }

        // if there is no simple type, then compare based on string
        if (!isSimple && !bElement.fDefault.normalizedValue.equals(dElement.fDefault.normalizedValue) ||
                isSimple && !bElement.fDefault.actualValue.equals(dElement.fDefault.actualValue)) {
            throw new XMLSchemaException("rcase-NameAndTypeOK.4.b",
                    new Object[]{dElement.fName,
                    dElement.fDefault.stringValue(),
                    bElement.fDefault.stringValue()});
        }
    }

    //
    // Check identity constraints
    //
    checkIDConstraintRestriction(dElement, bElement);

    //
    // Check for disallowed substitutions
    //
    int blockSet1 = dElement.fBlock;
    int blockSet2 = bElement.fBlock;
    if (((blockSet1 & blockSet2)!=blockSet2) ||
            (blockSet1==XSConstants.DERIVATION_NONE && blockSet2!=XSConstants.DERIVATION_NONE))
        throw new XMLSchemaException("rcase-NameAndTypeOK.6",
                new Object[]{dElement.fName});


    //
    // Check that the derived element's type is derived from the base's.
    //
    if (!checkTypeDerivationOk(dElement.fType, bElement.fType,
            (short)(XSConstants.DERIVATION_EXTENSION|XSConstants.DERIVATION_LIST|XSConstants.DERIVATION_UNION))) {
        throw new XMLSchemaException("rcase-NameAndTypeOK.7",
                new Object[]{dElement.fName, dElement.fType.getName(), bElement.fType.getName()});
    }

}