Java Code Examples for com.sun.org.apache.xerces.internal.impl.dv.XSSimpleType#validate()

The following examples show how to use com.sun.org.apache.xerces.internal.impl.dv.XSSimpleType#validate() . 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: XMLSchemaValidator.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
Object elementLocallyValidType(QName element, Object textContent) {
    if (fCurrentType == null)
        return null;

    Object retValue = null;
    // Element Locally Valid (Type)
    // 3 The appropriate case among the following must be true:
    // 3.1 If the type definition is a simple type definition, then all of the following must be true:
    if (fCurrentType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
        // 3.1.2 The element information item must have no element information item [children].
        if (fSubElement)
            reportSchemaError("cvc-type.3.1.2", new Object[] { element.rawname });
        // 3.1.3 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the normalized value must be valid with respect to the type definition as defined by String Valid (3.14.4).
        if (!fNil) {
            XSSimpleType dv = (XSSimpleType) fCurrentType;
            try {
                if (!fNormalizeData || fUnionType) {
                    fValidationState.setNormalizationRequired(true);
                }
                retValue = dv.validate(textContent, fValidationState, fValidatedInfo);
            } catch (InvalidDatatypeValueException e) {
                reportSchemaError(e.getKey(), e.getArgs());
                reportSchemaError(
                    "cvc-type.3.1.3",
                    new Object[] { element.rawname, textContent });
            }
        }
    } else {
        // 3.2 If the type definition is a complex type definition, then the element information item must be valid with respect to the type definition as per Element Locally Valid (Complex Type) (3.4.4);
        retValue = elementLocallyValidComplexType(element, textContent);
    }

    return retValue;
}
 
Example 2
Source File: XMLSchemaValidator.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
Object elementLocallyValidType(QName element, Object textContent) {
    if (fCurrentType == null)
        return null;

    Object retValue = null;
    // Element Locally Valid (Type)
    // 3 The appropriate case among the following must be true:
    // 3.1 If the type definition is a simple type definition, then all of the following must be true:
    if (fCurrentType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
        // 3.1.2 The element information item must have no element information item [children].
        if (fSubElement)
            reportSchemaError("cvc-type.3.1.2", new Object[] { element.rawname });
        // 3.1.3 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the normalized value must be valid with respect to the type definition as defined by String Valid (3.14.4).
        if (!fNil) {
            XSSimpleType dv = (XSSimpleType) fCurrentType;
            try {
                if (!fNormalizeData || fUnionType) {
                    fValidationState.setNormalizationRequired(true);
                }
                retValue = dv.validate(textContent, fValidationState, fValidatedInfo);
            } catch (InvalidDatatypeValueException e) {
                reportSchemaError(e.getKey(), e.getArgs());
                reportSchemaError(
                    "cvc-type.3.1.3",
                    new Object[] { element.rawname, textContent });
            }
        }
    } else {
        // 3.2 If the type definition is a complex type definition, then the element information item must be valid with respect to the type definition as per Element Locally Valid (Complex Type) (3.4.4);
        retValue = elementLocallyValidComplexType(element, textContent);
    }

    return retValue;
}
 
Example 3
Source File: XMLSchemaValidator.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
Object elementLocallyValidType(QName element, Object textContent) {
    if (fCurrentType == null)
        return null;

    Object retValue = null;
    // Element Locally Valid (Type)
    // 3 The appropriate case among the following must be true:
    // 3.1 If the type definition is a simple type definition, then all of the following must be true:
    if (fCurrentType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
        // 3.1.2 The element information item must have no element information item [children].
        if (fSubElement)
            reportSchemaError("cvc-type.3.1.2", new Object[] { element.rawname });
        // 3.1.3 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the normalized value must be valid with respect to the type definition as defined by String Valid (3.14.4).
        if (!fNil) {
            XSSimpleType dv = (XSSimpleType) fCurrentType;
            try {
                if (!fNormalizeData || fUnionType) {
                    fValidationState.setNormalizationRequired(true);
                }
                retValue = dv.validate(textContent, fValidationState, fValidatedInfo);
            } catch (InvalidDatatypeValueException e) {
                reportSchemaError(e.getKey(), e.getArgs());
                reportSchemaError(
                    "cvc-type.3.1.3",
                    new Object[] { element.rawname, textContent });
            }
        }
    } else {
        // 3.2 If the type definition is a complex type definition, then the element information item must be valid with respect to the type definition as per Element Locally Valid (Complex Type) (3.4.4);
        retValue = elementLocallyValidComplexType(element, textContent);
    }

    return retValue;
}
 
Example 4
Source File: XMLSchemaValidator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
Object elementLocallyValidType(QName element, Object textContent) {
    if (fCurrentType == null)
        return null;

    Object retValue = null;
    // Element Locally Valid (Type)
    // 3 The appropriate case among the following must be true:
    // 3.1 If the type definition is a simple type definition, then all of the following must be true:
    if (fCurrentType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
        // 3.1.2 The element information item must have no element information item [children].
        if (fSubElement)
            reportSchemaError("cvc-type.3.1.2", new Object[] { element.rawname });
        // 3.1.3 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the normalized value must be valid with respect to the type definition as defined by String Valid (3.14.4).
        if (!fNil) {
            XSSimpleType dv = (XSSimpleType) fCurrentType;
            try {
                if (!fNormalizeData || fUnionType) {
                    fValidationState.setNormalizationRequired(true);
                }
                retValue = dv.validate(textContent, fValidationState, fValidatedInfo);
            } catch (InvalidDatatypeValueException e) {
                reportSchemaError(e.getKey(), e.getArgs());
                reportSchemaError(
                    "cvc-type.3.1.3",
                    new Object[] { element.rawname, textContent });
            }
        }
    } else {
        // 3.2 If the type definition is a complex type definition, then the element information item must be valid with respect to the type definition as per Element Locally Valid (Complex Type) (3.4.4);
        retValue = elementLocallyValidComplexType(element, textContent);
    }

    return retValue;
}
 
Example 5
Source File: XMLSchemaValidator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
Object elementLocallyValidType(QName element, Object textContent) {
    if (fCurrentType == null)
        return null;

    Object retValue = null;
    // Element Locally Valid (Type)
    // 3 The appropriate case among the following must be true:
    // 3.1 If the type definition is a simple type definition, then all of the following must be true:
    if (fCurrentType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
        // 3.1.2 The element information item must have no element information item [children].
        if (fSubElement)
            reportSchemaError("cvc-type.3.1.2", new Object[] { element.rawname });
        // 3.1.3 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the normalized value must be valid with respect to the type definition as defined by String Valid (3.14.4).
        if (!fNil) {
            XSSimpleType dv = (XSSimpleType) fCurrentType;
            try {
                if (!fNormalizeData || fUnionType) {
                    fValidationState.setNormalizationRequired(true);
                }
                retValue = dv.validate(textContent, fValidationState, fValidatedInfo);
            } catch (InvalidDatatypeValueException e) {
                reportSchemaError(e.getKey(), e.getArgs());
                reportSchemaError(
                    "cvc-type.3.1.3",
                    new Object[] { element.rawname, textContent });
            }
        }
    } else {
        // 3.2 If the type definition is a complex type definition, then the element information item must be valid with respect to the type definition as per Element Locally Valid (Complex Type) (3.4.4);
        retValue = elementLocallyValidComplexType(element, textContent);
    }

    return retValue;
}
 
Example 6
Source File: XMLSchemaValidator.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
Object elementLocallyValidType(QName element, Object textContent) {
    if (fCurrentType == null)
        return null;

    Object retValue = null;
    // Element Locally Valid (Type)
    // 3 The appropriate case among the following must be true:
    // 3.1 If the type definition is a simple type definition, then all of the following must be true:
    if (fCurrentType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
        // 3.1.2 The element information item must have no element information item [children].
        if (fSubElement)
            reportSchemaError("cvc-type.3.1.2", new Object[] { element.rawname });
        // 3.1.3 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the normalized value must be valid with respect to the type definition as defined by String Valid (3.14.4).
        if (!fNil) {
            XSSimpleType dv = (XSSimpleType) fCurrentType;
            try {
                if (!fNormalizeData || fUnionType) {
                    fValidationState.setNormalizationRequired(true);
                }
                retValue = dv.validate(textContent, fValidationState, fValidatedInfo);
            } catch (InvalidDatatypeValueException e) {
                reportSchemaError(e.getKey(), e.getArgs());
                reportSchemaError(
                    "cvc-type.3.1.3",
                    new Object[] { element.rawname, textContent });
            }
        }
    } else {
        // 3.2 If the type definition is a complex type definition, then the element information item must be valid with respect to the type definition as per Element Locally Valid (Complex Type) (3.4.4);
        retValue = elementLocallyValidComplexType(element, textContent);
    }

    return retValue;
}
 
Example 7
Source File: XMLSchemaValidator.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
Object elementLocallyValidType(QName element, Object textContent) {
    if (fCurrentType == null)
        return null;

    Object retValue = null;
    // Element Locally Valid (Type)
    // 3 The appropriate case among the following must be true:
    // 3.1 If the type definition is a simple type definition, then all of the following must be true:
    if (fCurrentType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
        // 3.1.2 The element information item must have no element information item [children].
        if (fSubElement)
            reportSchemaError("cvc-type.3.1.2", new Object[] { element.rawname });
        // 3.1.3 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the normalized value must be valid with respect to the type definition as defined by String Valid (3.14.4).
        if (!fNil) {
            XSSimpleType dv = (XSSimpleType) fCurrentType;
            try {
                if (!fNormalizeData || fUnionType) {
                    fValidationState.setNormalizationRequired(true);
                }
                retValue = dv.validate(textContent, fValidationState, fValidatedInfo);
            } catch (InvalidDatatypeValueException e) {
                reportSchemaError(e.getKey(), e.getArgs());
                reportSchemaError(
                    "cvc-type.3.1.3",
                    new Object[] { element.rawname, textContent });
            }
        }
    } else {
        // 3.2 If the type definition is a complex type definition, then the element information item must be valid with respect to the type definition as per Element Locally Valid (Complex Type) (3.4.4);
        retValue = elementLocallyValidComplexType(element, textContent);
    }

    return retValue;
}
 
Example 8
Source File: XMLSchemaValidator.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
Object elementLocallyValidType(QName element, Object textContent) {
    if (fCurrentType == null)
        return null;

    Object retValue = null;
    // Element Locally Valid (Type)
    // 3 The appropriate case among the following must be true:
    // 3.1 If the type definition is a simple type definition, then all of the following must be true:
    if (fCurrentType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
        // 3.1.2 The element information item must have no element information item [children].
        if (fSubElement)
            reportSchemaError("cvc-type.3.1.2", new Object[] { element.rawname });
        // 3.1.3 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the normalized value must be valid with respect to the type definition as defined by String Valid (3.14.4).
        if (!fNil) {
            XSSimpleType dv = (XSSimpleType) fCurrentType;
            try {
                if (!fNormalizeData || fUnionType) {
                    fValidationState.setNormalizationRequired(true);
                }
                retValue = dv.validate(textContent, fValidationState, fValidatedInfo);
            } catch (InvalidDatatypeValueException e) {
                reportSchemaError(e.getKey(), e.getArgs());
                reportSchemaError(
                    "cvc-type.3.1.3",
                    new Object[] { element.rawname, textContent });
            }
        }
    } else {
        // 3.2 If the type definition is a complex type definition, then the element information item must be valid with respect to the type definition as per Element Locally Valid (Complex Type) (3.4.4);
        retValue = elementLocallyValidComplexType(element, textContent);
    }

    return retValue;
}
 
Example 9
Source File: XMLSchemaValidator.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
Object elementLocallyValidType(QName element, Object textContent) {
    if (fCurrentType == null)
        return null;

    Object retValue = null;
    // Element Locally Valid (Type)
    // 3 The appropriate case among the following must be true:
    // 3.1 If the type definition is a simple type definition, then all of the following must be true:
    if (fCurrentType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
        // 3.1.2 The element information item must have no element information item [children].
        if (fSubElement)
            reportSchemaError("cvc-type.3.1.2", new Object[] { element.rawname });
        // 3.1.3 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the normalized value must be valid with respect to the type definition as defined by String Valid (3.14.4).
        if (!fNil) {
            XSSimpleType dv = (XSSimpleType) fCurrentType;
            try {
                if (!fNormalizeData || fUnionType) {
                    fValidationState.setNormalizationRequired(true);
                }
                retValue = dv.validate(textContent, fValidationState, fValidatedInfo);
            } catch (InvalidDatatypeValueException e) {
                reportSchemaError(e.getKey(), e.getArgs());
                reportSchemaError(
                    "cvc-type.3.1.3",
                    new Object[] { element.rawname, textContent });
            }
        }
    } else {
        // 3.2 If the type definition is a complex type definition, then the element information item must be valid with respect to the type definition as per Element Locally Valid (Complex Type) (3.4.4);
        retValue = elementLocallyValidComplexType(element, textContent);
    }

    return retValue;
}
 
Example 10
Source File: XMLSchemaValidator.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
Object elementLocallyValidComplexType(QName element, Object textContent) {
    Object actualValue = null;
    XSComplexTypeDecl ctype = (XSComplexTypeDecl) fCurrentType;

    // Element Locally Valid (Complex Type)
    // For an element information item to be locally valid with respect to a complex type definition all of the following must be true:
    // 1 {abstract} is false.
    // 2 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the appropriate case among the following must be true:
    if (!fNil) {
        // 2.1 If the {content type} is empty, then the element information item has no character or element information item [children].
        if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_EMPTY
            && (fSubElement || fSawText)) {
            reportSchemaError("cvc-complex-type.2.1", new Object[] { element.rawname });
        }
        // 2.2 If the {content type} is a simple type definition, then the element information item has no element information item [children], and the normalized value of the element information item is valid with respect to that simple type definition as defined by String Valid (3.14.4).
        else if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE) {
            if (fSubElement)
                reportSchemaError("cvc-complex-type.2.2", new Object[] { element.rawname });
            XSSimpleType dv = ctype.fXSSimpleType;
            try {
                if (!fNormalizeData || fUnionType) {
                    fValidationState.setNormalizationRequired(true);
                }
                actualValue = dv.validate(textContent, fValidationState, fValidatedInfo);
            } catch (InvalidDatatypeValueException e) {
                reportSchemaError(e.getKey(), e.getArgs());
                reportSchemaError("cvc-complex-type.2.2", new Object[] { element.rawname });
            }
            // REVISIT: eventually, this method should return the same actualValue as elementLocallyValidType...
            // obviously it'll return null when the content is complex.
        }
        // 2.3 If the {content type} is element-only, then the element information item has no character information item [children] other than those whose [character code] is defined as a white space in [XML 1.0 (Second Edition)].
        else if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT) {
            if (fSawCharacters) {
                reportSchemaError("cvc-complex-type.2.3", new Object[] { element.rawname });
            }
        }
        // 2.4 If the {content type} is element-only or mixed, then the sequence of the element information item's element information item [children], if any, taken in order, is valid with respect to the {content type}'s particle, as defined in Element Sequence Locally Valid (Particle) (3.9.4).
        if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT
            || ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_MIXED) {
            // if the current state is a valid state, check whether
            // it's one of the final states.
            if (DEBUG) {
                System.out.println(fCurrCMState);
            }
            if (fCurrCMState[0] >= 0 && !fCurrentCM.endContentModel(fCurrCMState)) {
                String expected = expectedStr(fCurrentCM.whatCanGoHere(fCurrCMState));
                reportSchemaError(
                    "cvc-complex-type.2.4.b",
                    new Object[] { element.rawname, expected });
            } else {
                // Constant space algorithm for a{n,m} for n > 1 and m <= unbounded
                // After the DFA has completed, check minOccurs and maxOccurs
                // for all elements and wildcards in this content model where
                // a{n,m} is subsumed to a* or a+
                ArrayList errors = fCurrentCM.checkMinMaxBounds();
                if (errors != null) {
                    for (int i = 0; i < errors.size(); i += 2) {
                        reportSchemaError(
                            (String) errors.get(i),
                            new Object[] { element.rawname, errors.get(i + 1) });
                    }
                }
            }
         }
    }
    return actualValue;
}
 
Example 11
Source File: XMLSchemaValidator.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
Object elementLocallyValidComplexType(QName element, Object textContent) {
    Object actualValue = null;
    XSComplexTypeDecl ctype = (XSComplexTypeDecl) fCurrentType;

    // Element Locally Valid (Complex Type)
    // For an element information item to be locally valid with respect to a complex type definition all of the following must be true:
    // 1 {abstract} is false.
    // 2 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the appropriate case among the following must be true:
    if (!fNil) {
        // 2.1 If the {content type} is empty, then the element information item has no character or element information item [children].
        if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_EMPTY
            && (fSubElement || fSawText)) {
            reportSchemaError("cvc-complex-type.2.1", new Object[] { element.rawname });
        }
        // 2.2 If the {content type} is a simple type definition, then the element information item has no element information item [children], and the normalized value of the element information item is valid with respect to that simple type definition as defined by String Valid (3.14.4).
        else if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE) {
            if (fSubElement)
                reportSchemaError("cvc-complex-type.2.2", new Object[] { element.rawname });
            XSSimpleType dv = ctype.fXSSimpleType;
            try {
                if (!fNormalizeData || fUnionType) {
                    fValidationState.setNormalizationRequired(true);
                }
                actualValue = dv.validate(textContent, fValidationState, fValidatedInfo);
            } catch (InvalidDatatypeValueException e) {
                reportSchemaError(e.getKey(), e.getArgs());
                reportSchemaError("cvc-complex-type.2.2", new Object[] { element.rawname });
            }
            // REVISIT: eventually, this method should return the same actualValue as elementLocallyValidType...
            // obviously it'll return null when the content is complex.
        }
        // 2.3 If the {content type} is element-only, then the element information item has no character information item [children] other than those whose [character code] is defined as a white space in [XML 1.0 (Second Edition)].
        else if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT) {
            if (fSawCharacters) {
                reportSchemaError("cvc-complex-type.2.3", new Object[] { element.rawname });
            }
        }
        // 2.4 If the {content type} is element-only or mixed, then the sequence of the element information item's element information item [children], if any, taken in order, is valid with respect to the {content type}'s particle, as defined in Element Sequence Locally Valid (Particle) (3.9.4).
        if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT
            || ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_MIXED) {
            // if the current state is a valid state, check whether
            // it's one of the final states.
            if (DEBUG) {
                System.out.println(fCurrCMState);
            }
            if (fCurrCMState[0] >= 0 && !fCurrentCM.endContentModel(fCurrCMState)) {
                String expected = expectedStr(fCurrentCM.whatCanGoHere(fCurrCMState));
                reportSchemaError(
                    "cvc-complex-type.2.4.b",
                    new Object[] { element.rawname, expected });
            } else {
                // Constant space algorithm for a{n,m} for n > 1 and m <= unbounded
                // After the DFA has completed, check minOccurs and maxOccurs
                // for all elements and wildcards in this content model where
                // a{n,m} is subsumed to a* or a+
                ArrayList errors = fCurrentCM.checkMinMaxBounds();
                if (errors != null) {
                    for (int i = 0; i < errors.size(); i += 2) {
                        reportSchemaError(
                            (String) errors.get(i),
                            new Object[] { element.rawname, errors.get(i + 1) });
                    }
                }
            }
         }
    }
    return actualValue;
}
 
Example 12
Source File: XSAttributeChecker.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void checkNonSchemaAttributes(XSGrammarBucket grammarBucket) {
    // for all attributes
    Iterator entries = fNonSchemaAttrs.entrySet().iterator();
    XSAttributeDecl attrDecl;
    while (entries.hasNext()) {
        Map.Entry entry = (Map.Entry) entries.next();
        // get name, uri, localpart
        String attrRName = (String) entry.getKey();
        String attrURI = attrRName.substring(0,attrRName.indexOf(','));
        String attrLocal = attrRName.substring(attrRName.indexOf(',')+1);
        // find associated grammar
        SchemaGrammar sGrammar = grammarBucket.getGrammar(attrURI);
        if (sGrammar == null) {
            continue;
        }
        // and get the datatype validator, if there is one
        attrDecl = sGrammar.getGlobalAttributeDecl(attrLocal);
        if (attrDecl == null) {
            continue;
        }
        XSSimpleType dv = (XSSimpleType)attrDecl.getTypeDefinition();
        if (dv == null) {
            continue;
        }

        // get all values appeared with this attribute name
        Vector values = (Vector) entry.getValue();
        String elName;
        String attrName = (String)values.elementAt(0);
        // for each of the values
        int count = values.size();
        for (int i = 1; i < count; i += 2) {
            elName = (String)values.elementAt(i);
            try {
                // and validate it using the XSSimpleType
                // REVISIT: what would be the proper validation context?
                //          guess we need to save that in the vectors too.
                dv.validate((String)values.elementAt(i+1), null, null);
            } catch(InvalidDatatypeValueException ide) {
                reportSchemaError ("s4s-att-invalid-value",
                                   new Object[] {elName, attrName, ide.getMessage()},
                                   null);
            }
        }
    }
}
 
Example 13
Source File: XSAttributeChecker.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public void checkNonSchemaAttributes(XSGrammarBucket grammarBucket) {
    // for all attributes
    Iterator entries = fNonSchemaAttrs.entrySet().iterator();
    XSAttributeDecl attrDecl;
    while (entries.hasNext()) {
        Map.Entry entry = (Map.Entry) entries.next();
        // get name, uri, localpart
        String attrRName = (String) entry.getKey();
        String attrURI = attrRName.substring(0,attrRName.indexOf(','));
        String attrLocal = attrRName.substring(attrRName.indexOf(',')+1);
        // find associated grammar
        SchemaGrammar sGrammar = grammarBucket.getGrammar(attrURI);
        if (sGrammar == null) {
            continue;
        }
        // and get the datatype validator, if there is one
        attrDecl = sGrammar.getGlobalAttributeDecl(attrLocal);
        if (attrDecl == null) {
            continue;
        }
        XSSimpleType dv = (XSSimpleType)attrDecl.getTypeDefinition();
        if (dv == null) {
            continue;
        }

        // get all values appeared with this attribute name
        Vector values = (Vector) entry.getValue();
        String elName;
        String attrName = (String)values.elementAt(0);
        // for each of the values
        int count = values.size();
        for (int i = 1; i < count; i += 2) {
            elName = (String)values.elementAt(i);
            try {
                // and validate it using the XSSimpleType
                // REVISIT: what would be the proper validation context?
                //          guess we need to save that in the vectors too.
                dv.validate((String)values.elementAt(i+1), null, null);
            } catch(InvalidDatatypeValueException ide) {
                reportSchemaError ("s4s-att-invalid-value",
                                   new Object[] {elName, attrName, ide.getMessage()},
                                   null);
            }
        }
    }
}
 
Example 14
Source File: XMLSchemaValidator.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
Object elementLocallyValidComplexType(QName element, Object textContent) {
    Object actualValue = null;
    XSComplexTypeDecl ctype = (XSComplexTypeDecl) fCurrentType;

    // Element Locally Valid (Complex Type)
    // For an element information item to be locally valid with respect to a complex type definition all of the following must be true:
    // 1 {abstract} is false.
    // 2 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the appropriate case among the following must be true:
    if (!fNil) {
        // 2.1 If the {content type} is empty, then the element information item has no character or element information item [children].
        if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_EMPTY
            && (fSubElement || fSawText)) {
            reportSchemaError("cvc-complex-type.2.1", new Object[] { element.rawname });
        }
        // 2.2 If the {content type} is a simple type definition, then the element information item has no element information item [children], and the normalized value of the element information item is valid with respect to that simple type definition as defined by String Valid (3.14.4).
        else if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE) {
            if (fSubElement)
                reportSchemaError("cvc-complex-type.2.2", new Object[] { element.rawname });
            XSSimpleType dv = ctype.fXSSimpleType;
            try {
                if (!fNormalizeData || fUnionType) {
                    fValidationState.setNormalizationRequired(true);
                }
                actualValue = dv.validate(textContent, fValidationState, fValidatedInfo);
            } catch (InvalidDatatypeValueException e) {
                reportSchemaError(e.getKey(), e.getArgs());
                reportSchemaError("cvc-complex-type.2.2", new Object[] { element.rawname });
            }
            // REVISIT: eventually, this method should return the same actualValue as elementLocallyValidType...
            // obviously it'll return null when the content is complex.
        }
        // 2.3 If the {content type} is element-only, then the element information item has no character information item [children] other than those whose [character code] is defined as a white space in [XML 1.0 (Second Edition)].
        else if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT) {
            if (fSawCharacters) {
                reportSchemaError("cvc-complex-type.2.3", new Object[] { element.rawname });
            }
        }
        // 2.4 If the {content type} is element-only or mixed, then the sequence of the element information item's element information item [children], if any, taken in order, is valid with respect to the {content type}'s particle, as defined in Element Sequence Locally Valid (Particle) (3.9.4).
        if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT
            || ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_MIXED) {
            // if the current state is a valid state, check whether
            // it's one of the final states.
            if (DEBUG) {
                System.out.println(fCurrCMState);
            }
            if (fCurrCMState[0] >= 0 && !fCurrentCM.endContentModel(fCurrCMState)) {
                String expected = expectedStr(fCurrentCM.whatCanGoHere(fCurrCMState));
                reportSchemaError(
                    "cvc-complex-type.2.4.b",
                    new Object[] { element.rawname, expected });
            } else {
                // Constant space algorithm for a{n,m} for n > 1 and m <= unbounded
                // After the DFA has completed, check minOccurs and maxOccurs
                // for all elements and wildcards in this content model where
                // a{n,m} is subsumed to a* or a+
                ArrayList errors = fCurrentCM.checkMinMaxBounds();
                if (errors != null) {
                    for (int i = 0; i < errors.size(); i += 2) {
                        reportSchemaError(
                            (String) errors.get(i),
                            new Object[] { element.rawname, errors.get(i + 1) });
                    }
                }
            }
         }
    }
    return actualValue;
}
 
Example 15
Source File: XMLSchemaValidator.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
Object elementLocallyValidComplexType(QName element, Object textContent) {
    Object actualValue = null;
    XSComplexTypeDecl ctype = (XSComplexTypeDecl) fCurrentType;

    // Element Locally Valid (Complex Type)
    // For an element information item to be locally valid with respect to a complex type definition all of the following must be true:
    // 1 {abstract} is false.
    // 2 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the appropriate case among the following must be true:
    if (!fNil) {
        // 2.1 If the {content type} is empty, then the element information item has no character or element information item [children].
        if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_EMPTY
            && (fSubElement || fSawText)) {
            reportSchemaError("cvc-complex-type.2.1", new Object[] { element.rawname });
        }
        // 2.2 If the {content type} is a simple type definition, then the element information item has no element information item [children], and the normalized value of the element information item is valid with respect to that simple type definition as defined by String Valid (3.14.4).
        else if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE) {
            if (fSubElement)
                reportSchemaError("cvc-complex-type.2.2", new Object[] { element.rawname });
            XSSimpleType dv = ctype.fXSSimpleType;
            try {
                if (!fNormalizeData || fUnionType) {
                    fValidationState.setNormalizationRequired(true);
                }
                actualValue = dv.validate(textContent, fValidationState, fValidatedInfo);
            } catch (InvalidDatatypeValueException e) {
                reportSchemaError(e.getKey(), e.getArgs());
                reportSchemaError("cvc-complex-type.2.2", new Object[] { element.rawname });
            }
            // REVISIT: eventually, this method should return the same actualValue as elementLocallyValidType...
            // obviously it'll return null when the content is complex.
        }
        // 2.3 If the {content type} is element-only, then the element information item has no character information item [children] other than those whose [character code] is defined as a white space in [XML 1.0 (Second Edition)].
        else if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT) {
            if (fSawCharacters) {
                reportSchemaError("cvc-complex-type.2.3", new Object[] { element.rawname });
            }
        }
        // 2.4 If the {content type} is element-only or mixed, then the sequence of the element information item's element information item [children], if any, taken in order, is valid with respect to the {content type}'s particle, as defined in Element Sequence Locally Valid (Particle) (3.9.4).
        if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT
            || ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_MIXED) {
            // if the current state is a valid state, check whether
            // it's one of the final states.
            if (DEBUG) {
                System.out.println(fCurrCMState);
            }
            if (fCurrCMState[0] >= 0 && !fCurrentCM.endContentModel(fCurrCMState)) {
                String expected = expectedStr(fCurrentCM.whatCanGoHere(fCurrCMState));
                final int[] occurenceInfo = fCurrentCM.occurenceInfo(fCurrCMState);
                if (occurenceInfo != null) {
                    final int minOccurs = occurenceInfo[0];
                    final int count = occurenceInfo[2];
                    // Check if this is a violation of minOccurs
                    if (count < minOccurs) {
                        final int required = minOccurs - count;
                        if (required > 1) {
                            reportSchemaError("cvc-complex-type.2.4.j", new Object[] { element.rawname,
                                    fCurrentCM.getTermName(occurenceInfo[3]), Integer.toString(minOccurs), Integer.toString(required) });
                        }
                        else {
                            reportSchemaError("cvc-complex-type.2.4.i", new Object[] { element.rawname,
                                    fCurrentCM.getTermName(occurenceInfo[3]), Integer.toString(minOccurs) });
                        }
                    }
                    else {
                        reportSchemaError("cvc-complex-type.2.4.b", new Object[] { element.rawname, expected });
                    }
                }
                else {
                    reportSchemaError("cvc-complex-type.2.4.b", new Object[] { element.rawname, expected });
                }
            } else {
                // Constant space algorithm for a{n,m} for n > 1 and m <= unbounded
                // After the DFA has completed, check minOccurs and maxOccurs
                // for all elements and wildcards in this content model where
                // a{n,m} is subsumed to a* or a+
                ArrayList errors = fCurrentCM.checkMinMaxBounds();
                if (errors != null) {
                    for (int i = 0; i < errors.size(); i += 2) {
                        reportSchemaError(
                            (String) errors.get(i),
                            new Object[] { element.rawname, errors.get(i + 1) });
                    }
                }
            }
        }
    }
    return actualValue;
}
 
Example 16
Source File: XMLSchemaValidator.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
Object elementLocallyValidComplexType(QName element, Object textContent) {
    Object actualValue = null;
    XSComplexTypeDecl ctype = (XSComplexTypeDecl) fCurrentType;

    // Element Locally Valid (Complex Type)
    // For an element information item to be locally valid with respect to a complex type definition all of the following must be true:
    // 1 {abstract} is false.
    // 2 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the appropriate case among the following must be true:
    if (!fNil) {
        // 2.1 If the {content type} is empty, then the element information item has no character or element information item [children].
        if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_EMPTY
            && (fSubElement || fSawText)) {
            reportSchemaError("cvc-complex-type.2.1", new Object[] { element.rawname });
        }
        // 2.2 If the {content type} is a simple type definition, then the element information item has no element information item [children], and the normalized value of the element information item is valid with respect to that simple type definition as defined by String Valid (3.14.4).
        else if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE) {
            if (fSubElement)
                reportSchemaError("cvc-complex-type.2.2", new Object[] { element.rawname });
            XSSimpleType dv = ctype.fXSSimpleType;
            try {
                if (!fNormalizeData || fUnionType) {
                    fValidationState.setNormalizationRequired(true);
                }
                actualValue = dv.validate(textContent, fValidationState, fValidatedInfo);
            } catch (InvalidDatatypeValueException e) {
                reportSchemaError(e.getKey(), e.getArgs());
                reportSchemaError("cvc-complex-type.2.2", new Object[] { element.rawname });
            }
            // REVISIT: eventually, this method should return the same actualValue as elementLocallyValidType...
            // obviously it'll return null when the content is complex.
        }
        // 2.3 If the {content type} is element-only, then the element information item has no character information item [children] other than those whose [character code] is defined as a white space in [XML 1.0 (Second Edition)].
        else if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT) {
            if (fSawCharacters) {
                reportSchemaError("cvc-complex-type.2.3", new Object[] { element.rawname });
            }
        }
        // 2.4 If the {content type} is element-only or mixed, then the sequence of the element information item's element information item [children], if any, taken in order, is valid with respect to the {content type}'s particle, as defined in Element Sequence Locally Valid (Particle) (3.9.4).
        if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT
            || ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_MIXED) {
            // if the current state is a valid state, check whether
            // it's one of the final states.
            if (DEBUG) {
                System.out.println(fCurrCMState);
            }
            if (fCurrCMState[0] >= 0 && !fCurrentCM.endContentModel(fCurrCMState)) {
                String expected = expectedStr(fCurrentCM.whatCanGoHere(fCurrCMState));
                reportSchemaError(
                    "cvc-complex-type.2.4.b",
                    new Object[] { element.rawname, expected });
            } else {
                // Constant space algorithm for a{n,m} for n > 1 and m <= unbounded
                // After the DFA has completed, check minOccurs and maxOccurs
                // for all elements and wildcards in this content model where
                // a{n,m} is subsumed to a* or a+
                ArrayList errors = fCurrentCM.checkMinMaxBounds();
                if (errors != null) {
                    for (int i = 0; i < errors.size(); i += 2) {
                        reportSchemaError(
                            (String) errors.get(i),
                            new Object[] { element.rawname, errors.get(i + 1) });
                    }
                }
            }
         }
    }
    return actualValue;
}
 
Example 17
Source File: XMLSchemaValidator.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
Object elementLocallyValidComplexType(QName element, Object textContent) {
    Object actualValue = null;
    XSComplexTypeDecl ctype = (XSComplexTypeDecl) fCurrentType;

    // Element Locally Valid (Complex Type)
    // For an element information item to be locally valid with respect to a complex type definition all of the following must be true:
    // 1 {abstract} is false.
    // 2 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the appropriate case among the following must be true:
    if (!fNil) {
        // 2.1 If the {content type} is empty, then the element information item has no character or element information item [children].
        if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_EMPTY
            && (fSubElement || fSawText)) {
            reportSchemaError("cvc-complex-type.2.1", new Object[] { element.rawname });
        }
        // 2.2 If the {content type} is a simple type definition, then the element information item has no element information item [children], and the normalized value of the element information item is valid with respect to that simple type definition as defined by String Valid (3.14.4).
        else if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE) {
            if (fSubElement)
                reportSchemaError("cvc-complex-type.2.2", new Object[] { element.rawname });
            XSSimpleType dv = ctype.fXSSimpleType;
            try {
                if (!fNormalizeData || fUnionType) {
                    fValidationState.setNormalizationRequired(true);
                }
                actualValue = dv.validate(textContent, fValidationState, fValidatedInfo);
            } catch (InvalidDatatypeValueException e) {
                reportSchemaError(e.getKey(), e.getArgs());
                reportSchemaError("cvc-complex-type.2.2", new Object[] { element.rawname });
            }
            // REVISIT: eventually, this method should return the same actualValue as elementLocallyValidType...
            // obviously it'll return null when the content is complex.
        }
        // 2.3 If the {content type} is element-only, then the element information item has no character information item [children] other than those whose [character code] is defined as a white space in [XML 1.0 (Second Edition)].
        else if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT) {
            if (fSawCharacters) {
                reportSchemaError("cvc-complex-type.2.3", new Object[] { element.rawname });
            }
        }
        // 2.4 If the {content type} is element-only or mixed, then the sequence of the element information item's element information item [children], if any, taken in order, is valid with respect to the {content type}'s particle, as defined in Element Sequence Locally Valid (Particle) (3.9.4).
        if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT
            || ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_MIXED) {
            // if the current state is a valid state, check whether
            // it's one of the final states.
            if (DEBUG) {
                System.out.println(fCurrCMState);
            }
            if (fCurrCMState[0] >= 0 && !fCurrentCM.endContentModel(fCurrCMState)) {
                String expected = expectedStr(fCurrentCM.whatCanGoHere(fCurrCMState));
                final int[] occurenceInfo = fCurrentCM.occurenceInfo(fCurrCMState);
                if (occurenceInfo != null) {
                    final int minOccurs = occurenceInfo[0];
                    final int count = occurenceInfo[2];
                    // Check if this is a violation of minOccurs
                    if (count < minOccurs) {
                        final int required = minOccurs - count;
                        if (required > 1) {
                            reportSchemaError("cvc-complex-type.2.4.j", new Object[] { element.rawname,
                                    fCurrentCM.getTermName(occurenceInfo[3]), Integer.toString(minOccurs), Integer.toString(required) });
                        }
                        else {
                            reportSchemaError("cvc-complex-type.2.4.i", new Object[] { element.rawname,
                                    fCurrentCM.getTermName(occurenceInfo[3]), Integer.toString(minOccurs) });
                        }
                    }
                    else {
                        reportSchemaError("cvc-complex-type.2.4.b", new Object[] { element.rawname, expected });
                    }
                }
                else {
                    reportSchemaError("cvc-complex-type.2.4.b", new Object[] { element.rawname, expected });
                }
            } else {
                // Constant space algorithm for a{n,m} for n > 1 and m <= unbounded
                // After the DFA has completed, check minOccurs and maxOccurs
                // for all elements and wildcards in this content model where
                // a{n,m} is subsumed to a* or a+
                List<String> errors = fCurrentCM.checkMinMaxBounds();
                if (errors != null) {
                    for (int i = 0; i < errors.size(); i += 2) {
                        reportSchemaError(errors.get(i),
                            new Object[] { element.rawname, errors.get(i + 1) });
                    }
                }
            }
        }
    }
    return actualValue;
}
 
Example 18
Source File: XSAttributeChecker.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void checkNonSchemaAttributes(XSGrammarBucket grammarBucket) {
    // for all attributes
    Iterator entries = fNonSchemaAttrs.entrySet().iterator();
    XSAttributeDecl attrDecl;
    while (entries.hasNext()) {
        Map.Entry entry = (Map.Entry) entries.next();
        // get name, uri, localpart
        String attrRName = (String) entry.getKey();
        String attrURI = attrRName.substring(0,attrRName.indexOf(','));
        String attrLocal = attrRName.substring(attrRName.indexOf(',')+1);
        // find associated grammar
        SchemaGrammar sGrammar = grammarBucket.getGrammar(attrURI);
        if (sGrammar == null) {
            continue;
        }
        // and get the datatype validator, if there is one
        attrDecl = sGrammar.getGlobalAttributeDecl(attrLocal);
        if (attrDecl == null) {
            continue;
        }
        XSSimpleType dv = (XSSimpleType)attrDecl.getTypeDefinition();
        if (dv == null) {
            continue;
        }

        // get all values appeared with this attribute name
        Vector values = (Vector) entry.getValue();
        String elName;
        String attrName = (String)values.elementAt(0);
        // for each of the values
        int count = values.size();
        for (int i = 1; i < count; i += 2) {
            elName = (String)values.elementAt(i);
            try {
                // and validate it using the XSSimpleType
                // REVISIT: what would be the proper validation context?
                //          guess we need to save that in the vectors too.
                dv.validate((String)values.elementAt(i+1), null, null);
            } catch(InvalidDatatypeValueException ide) {
                reportSchemaError ("s4s-att-invalid-value",
                                   new Object[] {elName, attrName, ide.getMessage()},
                                   null);
            }
        }
    }
}
 
Example 19
Source File: XSAttributeChecker.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public void checkNonSchemaAttributes(XSGrammarBucket grammarBucket) {
    // for all attributes
    Iterator entries = fNonSchemaAttrs.entrySet().iterator();
    XSAttributeDecl attrDecl;
    while (entries.hasNext()) {
        Map.Entry entry = (Map.Entry) entries.next();
        // get name, uri, localpart
        String attrRName = (String) entry.getKey();
        String attrURI = attrRName.substring(0,attrRName.indexOf(','));
        String attrLocal = attrRName.substring(attrRName.indexOf(',')+1);
        // find associated grammar
        SchemaGrammar sGrammar = grammarBucket.getGrammar(attrURI);
        if (sGrammar == null) {
            continue;
        }
        // and get the datatype validator, if there is one
        attrDecl = sGrammar.getGlobalAttributeDecl(attrLocal);
        if (attrDecl == null) {
            continue;
        }
        XSSimpleType dv = (XSSimpleType)attrDecl.getTypeDefinition();
        if (dv == null) {
            continue;
        }

        // get all values appeared with this attribute name
        Vector values = (Vector) entry.getValue();
        String elName;
        String attrName = (String)values.elementAt(0);
        // for each of the values
        int count = values.size();
        for (int i = 1; i < count; i += 2) {
            elName = (String)values.elementAt(i);
            try {
                // and validate it using the XSSimpleType
                // REVISIT: what would be the proper validation context?
                //          guess we need to save that in the vectors too.
                dv.validate((String)values.elementAt(i+1), null, null);
            } catch(InvalidDatatypeValueException ide) {
                reportSchemaError ("s4s-att-invalid-value",
                                   new Object[] {elName, attrName, ide.getMessage()},
                                   null);
            }
        }
    }
}
 
Example 20
Source File: XMLSchemaValidator.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
Object elementLocallyValidComplexType(QName element, Object textContent) {
    Object actualValue = null;
    XSComplexTypeDecl ctype = (XSComplexTypeDecl) fCurrentType;

    // Element Locally Valid (Complex Type)
    // For an element information item to be locally valid with respect to a complex type definition all of the following must be true:
    // 1 {abstract} is false.
    // 2 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the appropriate case among the following must be true:
    if (!fNil) {
        // 2.1 If the {content type} is empty, then the element information item has no character or element information item [children].
        if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_EMPTY
            && (fSubElement || fSawText)) {
            reportSchemaError("cvc-complex-type.2.1", new Object[] { element.rawname });
        }
        // 2.2 If the {content type} is a simple type definition, then the element information item has no element information item [children], and the normalized value of the element information item is valid with respect to that simple type definition as defined by String Valid (3.14.4).
        else if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE) {
            if (fSubElement)
                reportSchemaError("cvc-complex-type.2.2", new Object[] { element.rawname });
            XSSimpleType dv = ctype.fXSSimpleType;
            try {
                if (!fNormalizeData || fUnionType) {
                    fValidationState.setNormalizationRequired(true);
                }
                actualValue = dv.validate(textContent, fValidationState, fValidatedInfo);
            } catch (InvalidDatatypeValueException e) {
                reportSchemaError(e.getKey(), e.getArgs());
                reportSchemaError("cvc-complex-type.2.2", new Object[] { element.rawname });
            }
            // REVISIT: eventually, this method should return the same actualValue as elementLocallyValidType...
            // obviously it'll return null when the content is complex.
        }
        // 2.3 If the {content type} is element-only, then the element information item has no character information item [children] other than those whose [character code] is defined as a white space in [XML 1.0 (Second Edition)].
        else if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT) {
            if (fSawCharacters) {
                reportSchemaError("cvc-complex-type.2.3", new Object[] { element.rawname });
            }
        }
        // 2.4 If the {content type} is element-only or mixed, then the sequence of the element information item's element information item [children], if any, taken in order, is valid with respect to the {content type}'s particle, as defined in Element Sequence Locally Valid (Particle) (3.9.4).
        if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT
            || ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_MIXED) {
            // if the current state is a valid state, check whether
            // it's one of the final states.
            if (DEBUG) {
                System.out.println(fCurrCMState);
            }
            if (fCurrCMState[0] >= 0 && !fCurrentCM.endContentModel(fCurrCMState)) {
                String expected = expectedStr(fCurrentCM.whatCanGoHere(fCurrCMState));
                reportSchemaError(
                    "cvc-complex-type.2.4.b",
                    new Object[] { element.rawname, expected });
            } else {
                // Constant space algorithm for a{n,m} for n > 1 and m <= unbounded
                // After the DFA has completed, check minOccurs and maxOccurs
                // for all elements and wildcards in this content model where
                // a{n,m} is subsumed to a* or a+
                ArrayList errors = fCurrentCM.checkMinMaxBounds();
                if (errors != null) {
                    for (int i = 0; i < errors.size(); i += 2) {
                        reportSchemaError(
                            (String) errors.get(i),
                            new Object[] { element.rawname, errors.get(i + 1) });
                    }
                }
            }
         }
    }
    return actualValue;
}