• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ValidationContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.org.apache.xerces.internal.impl.dv.ValidationContext的典型用法代码示例。如果您正苦于以下问题:Java ValidationContext类的具体用法?Java ValidationContext怎么用?Java ValidationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ValidationContext类属于com.sun.org.apache.xerces.internal.impl.dv包,在下文中一共展示了ValidationContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: validate

import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; //导入依赖的package包/类
/**
 * 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);
    }

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:XSSimpleTypeDecl.java


示例2: getActualValue

import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; //导入依赖的package包/类
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
    // check 3.2.17.c0 must: URI (rfc 2396/2723)
    try {
        if( content.length() != 0 ) {
            // encode special characters using XLink 5.4 algorithm
            final String encoded = encode(content);
            // Support for relative URLs
            // According to Java 1.1: URLs may also be specified with a
            // String and the URL object that it is related to.
            new URI(BASE_URI, encoded );
        }
    } catch (URI.MalformedURIException ex) {
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "anyURI"});
    }

    // REVISIT: do we need to return the new URI object?
    return content;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:AnyURIDV.java


示例3: applyFacets

import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:XSSimpleTypeDecl.java


示例4: checkExtraRules

import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; //导入依赖的package包/类
private void checkExtraRules(ValidationContext context, ValidatedInfo validatedInfo) throws InvalidDatatypeValueException {

        Object ob = validatedInfo.actualValue;

        if (fVariety == VARIETY_ATOMIC) {

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

        } else if (fVariety == VARIETY_LIST) {

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

        } else { // (fVariety == VARIETY_UNION)

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

        }

    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:XSSimpleTypeDecl.java


示例5: getActualValue

import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; //导入依赖的package包/类
/**
 * 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, "gYear"});
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:YearDV.java


示例6: getActualValue

import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; //导入依赖的package包/类
@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"});
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:DecimalDV.java


示例7: getActualValue

import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; //导入依赖的package包/类
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"});
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:DateDV.java


示例8: getActualValue

import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; //导入依赖的package包/类
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException{
    try{
        return parse(content, DURATION_TYPE);
    } catch (Exception ex) {
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "duration"});
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:DurationDV.java


示例9: getActualValue

import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; //导入依赖的package包/类
/**
 * 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"});
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:MonthDV.java


示例10: getActualValue

import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; //导入依赖的package包/类
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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:HexBinaryDV.java


示例11: getActualValue

import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; //导入依赖的package包/类
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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:BooleanDV.java


示例12: getActualValue

import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; //导入依赖的package包/类
public Object getActualValue(String content, ValidationContext context)
    throws InvalidDatatypeValueException {

    // "prefix:localpart" or "localpart"
    // get prefix and local part out of content
    String prefix, localpart;
    int colonptr = content.indexOf(":");
    if (colonptr > 0) {
        prefix = context.getSymbol(content.substring(0,colonptr));
        localpart = content.substring(colonptr+1);
    } else {
        prefix = EMPTY_STRING;
        localpart = content;
    }

    // both prefix (if any) a nd localpart must be valid NCName
    if (prefix.length() > 0 && !XMLChar.isValidNCName(prefix))
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "QName"});

    if(!XMLChar.isValidNCName(localpart))
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "QName"});

    // resove prefix to a uri, report an error if failed
    String uri = context.getURI(prefix);
    if (prefix.length() > 0 && uri == null)
        throw new InvalidDatatypeValueException("UndeclaredPrefix", new Object[]{content, prefix});

    return new XQName(prefix, context.getSymbol(localpart), context.getSymbol(content), uri);

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:QNameDV.java


示例13: getActualValue

import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; //导入依赖的package包/类
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, "gDay"});
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:DayDV.java


示例14: getActualValue

import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; //导入依赖的package包/类
/**
 * 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"});
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:TimeDV.java


示例15: getActualValue

import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; //导入依赖的package包/类
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
    try{
        return new XFloat(content);
    } catch (NumberFormatException ex){
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "float"});
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:FloatDV.java


示例16: getActualValue

import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; //导入依赖的package包/类
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"});
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:DoubleDV.java


示例17: getActualValue

import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; //导入依赖的package包/类
/**
 * 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"});
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:MonthDayDV.java


示例18: getActualValue

import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; //导入依赖的package包/类
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, "dateTime"});
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:DateTimeDV.java


示例19: getActualValue

import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; //导入依赖的package包/类
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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:EntityDV.java


示例20: getActualValue

import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; //导入依赖的package包/类
/**
 * Convert a string to a compiled form
 *
 * @param  content The lexical representation of gYearMonth
 * @return a valid and normalized gYearMonth 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, "gYearMonth"});
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:YearMonthDV.java



注:本文中的com.sun.org.apache.xerces.internal.impl.dv.ValidationContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DSAKeyParameters类代码示例发布时间:2022-05-23
下一篇:
Java IPagingLabelProvider类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap