Search in sources :

Example 1 with ValidationState

use of org.apache.xerces.impl.validation.ValidationState in project jena by apache.

the class XSDDatatype method parse.

/**
     * Parse a lexical form of this datatype to a value
     * @throws DatatypeFormatException if the lexical form is not legal
     */
@Override
public Object parse(String lexicalForm) throws DatatypeFormatException {
    try {
        ValidationContext context = new ValidationState();
        ValidatedInfo resultInfo = new ValidatedInfo();
        typeDeclaration.validate(lexicalForm, context, resultInfo);
        return convertValidatedDataValue(resultInfo);
    } catch (InvalidDatatypeValueException e) {
        throw new DatatypeFormatException(lexicalForm, this, "during parse -" + e);
    }
}
Also used : ValidationState(org.apache.xerces.impl.validation.ValidationState) DatatypeFormatException(org.apache.jena.datatypes.DatatypeFormatException)

Aggregations

DatatypeFormatException (org.apache.jena.datatypes.DatatypeFormatException)1 ValidationState (org.apache.xerces.impl.validation.ValidationState)1