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

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

    if (context == null)
        context = fEmptyContext;

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

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

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

    if (context == null)
        context = fEmptyContext;

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

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

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

    if (context == null)
        context = fEmptyContext;

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

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

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

    if (context == null)
        context = fEmptyContext;

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

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

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

    if (context == null)
        context = fEmptyContext;

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

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

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

    if (context == null)
        context = fEmptyContext;

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

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

}
 
Example #7
Source File: DayTimeDurationDV.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public Object getActualValue(String content, ValidationContext context)
    throws InvalidDatatypeValueException {
    try {
        return parse(content, DurationDV.DAYTIMEDURATION_TYPE);
    }
    catch (Exception ex) {
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "dayTimeDuration"});
    }
}
 
Example #8
Source File: MonthDayDV.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Convert a string to a compiled form
 *
 * @param  content The lexical representation of gMonthDay
 * @return a valid and normalized gMonthDay object
 */
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
    try{
        return parse(content);
    } catch(Exception ex){
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "gMonthDay"});
    }
}
 
Example #9
Source File: PrecisionDecimalDV.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Object getActualValue(String content, ValidationContext context)
throws InvalidDatatypeValueException {
    try {
        return new XPrecisionDecimal(content);
    } catch (NumberFormatException nfe) {
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "precisionDecimal"});
    }
}
 
Example #10
Source File: DayTimeDurationDV.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public Object getActualValue(String content, ValidationContext context)
    throws InvalidDatatypeValueException {
    try {
        return parse(content, DurationDV.DAYTIMEDURATION_TYPE);
    }
    catch (Exception ex) {
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "dayTimeDuration"});
    }
}
 
Example #11
Source File: DayTimeDurationDV.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public Object getActualValue(String content, ValidationContext context)
    throws InvalidDatatypeValueException {
    try {
        return parse(content, DurationDV.DAYTIMEDURATION_TYPE);
    }
    catch (Exception ex) {
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "dayTimeDuration"});
    }
}
 
Example #12
Source File: DateDV.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
    try{
        return parse(content);
    } catch(Exception ex){
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "date"});
    }
}
 
Example #13
Source File: EntityDV.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
    if (!XMLChar.isValidNCName(content)) {
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "NCName"});
    }

    return content;
}
 
Example #14
Source File: IntegerDV.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
    try {
        return new XDecimal(content, true);
    } catch (NumberFormatException nfe) {
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "integer"});
    }
}
 
Example #15
Source File: DoubleDV.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
    try{
        return new XDouble(content);
    } catch (NumberFormatException ex){
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "double"});
    }
}
 
Example #16
Source File: BooleanDV.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
    Boolean ret = null;

    if (content.equals(fValueSpace[0]) || content.equals(fValueSpace[2]))
        ret = Boolean.FALSE;
    else if (content.equals(fValueSpace[1]) || content.equals(fValueSpace[3]))
        ret = Boolean.TRUE;
    else
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "boolean"});
    return ret;
}
 
Example #17
Source File: Base64BinaryDV.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
    byte[] decoded = Base64.decode(content);
    if (decoded == null)
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "base64Binary"});

    return new XBase64(decoded);
}
 
Example #18
Source File: DoubleDV.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
    try{
        return new XDouble(content);
    } catch (NumberFormatException ex){
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "double"});
    }
}
 
Example #19
Source File: XSSimpleTypeDecl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If <restriction> is chosen
 */
public void applyFacets(XSFacets facets, short presentFacet, short fixedFacet, ValidationContext context)
throws InvalidDatatypeFacetException {
    if (context == null) {
        context = fEmptyContext;
    }
    applyFacets(facets, presentFacet, fixedFacet, SPECIAL_PATTERN_NONE, context);
}
 
Example #20
Source File: HexBinaryDV.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
    byte[] decoded = HexBin.decode(content);
    if (decoded == null)
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "hexBinary"});

    return new XHex(decoded);
}
 
Example #21
Source File: DateDV.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
    try{
        return parse(content);
    } catch(Exception ex){
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "date"});
    }
}
 
Example #22
Source File: DayTimeDurationDV.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public Object getActualValue(String content, ValidationContext context)
    throws InvalidDatatypeValueException {
    try {
        return parse(content, DurationDV.DAYTIMEDURATION_TYPE);
    }
    catch (Exception ex) {
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "dayTimeDuration"});
    }
}
 
Example #23
Source File: MonthDV.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Convert a string to a compiled form
 *
 * @param  content The lexical representation of gMonth
 * @return a valid and normalized gMonth object
 */
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException{
    try{
        return parse(content);
    } catch(Exception ex){
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "gMonth"});
    }
}
 
Example #24
Source File: Base64BinaryDV.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
    byte[] decoded = Base64.decode(content);
    if (decoded == null)
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "base64Binary"});

    return new XBase64(decoded);
}
 
Example #25
Source File: PrecisionDecimalDV.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Object getActualValue(String content, ValidationContext context)
throws InvalidDatatypeValueException {
    try {
        return new XPrecisionDecimal(content);
    } catch (NumberFormatException nfe) {
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "precisionDecimal"});
    }
}
 
Example #26
Source File: XSSimpleTypeDecl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If <restriction> is chosen
 */
public void applyFacets(XSFacets facets, short presentFacet, short fixedFacet, ValidationContext context)
throws InvalidDatatypeFacetException {
    if (context == null) {
        context = fEmptyContext;
    }
    applyFacets(facets, presentFacet, fixedFacet, SPECIAL_PATTERN_NONE, context);
}
 
Example #27
Source File: TimeDV.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Convert a string to a compiled form
 *
 * @param  content The lexical representation of time
 * @return a valid and normalized time object
 */
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException{
    try{
        return parse(content);
    } catch(Exception ex){
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "time"});
    }
}
 
Example #28
Source File: DecimalDV.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
    try {
        return new XDecimal(content);
    } catch (NumberFormatException nfe) {
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "decimal"});
    }
}
 
Example #29
Source File: YearMonthDurationDV.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public Object getActualValue(String content, ValidationContext context)
    throws InvalidDatatypeValueException {
    try {
        return parse(content, DurationDV.YEARMONTHDURATION_TYPE);
    }
    catch (Exception ex) {
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "yearMonthDuration"});
    }
}
 
Example #30
Source File: DecimalDV.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
    try {
        return new XDecimal(content);
    } catch (NumberFormatException nfe) {
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "decimal"});
    }
}