当前位置: 首页>>代码示例>>Java>>正文


Java XSConstants.DERIVATION_SUBSTITUTION属性代码示例

本文整理汇总了Java中org.apache.xerces.xs.XSConstants.DERIVATION_SUBSTITUTION属性的典型用法代码示例。如果您正苦于以下问题:Java XSConstants.DERIVATION_SUBSTITUTION属性的具体用法?Java XSConstants.DERIVATION_SUBSTITUTION怎么用?Java XSConstants.DERIVATION_SUBSTITUTION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.xerces.xs.XSConstants的用法示例。


在下文中一共展示了XSConstants.DERIVATION_SUBSTITUTION属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: translateDerivation

private String translateDerivation(short deriv) {
    switch (deriv) {
        case XSConstants.DERIVATION_EXTENSION :
            return SchemaSymbols.ELT_EXTENSION;
        case XSConstants.DERIVATION_LIST :
            return SchemaSymbols.ELT_LIST;
        case XSConstants.DERIVATION_RESTRICTION :
            return SchemaSymbols.ELT_RESTRICTION;
        case XSConstants.DERIVATION_SUBSTITUTION :
            return SchemaSymbols.ATTVAL_SUBSTITUTION;
        case XSConstants.DERIVATION_UNION :
            return SchemaSymbols.ELT_UNION;
        case XSConstants.DERIVATION_NONE :
            return null;
        default :
            return "unknown";
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:18,代码来源:PSVIWriter.java

示例2: getMatchingElemDecl

public XSElementDecl getMatchingElemDecl(QName element, XSElementDecl exemplar) {
    if (element.localpart == exemplar.fName &&
        element.uri == exemplar.fTargetNamespace) {
        return exemplar;
    }

    // if the exemplar is not a global element decl, then it's not possible
    // to be substituted by another element.
    if (exemplar.fScope != XSConstants.SCOPE_GLOBAL) {
        return null;
    }

    // if the decl blocks substitution, return false
    if ((exemplar.fBlock & XSConstants.DERIVATION_SUBSTITUTION) != 0) {
        return null;
    }

    // get the decl for the element
    XSElementDecl eDecl = fXSElementDeclHelper.getGlobalElementDecl(element);
    if (eDecl == null) {
        return null;
    }

    // and check by using substitutionGroup information
    if (substitutionGroupOK(eDecl, exemplar, exemplar.fBlock)) {
        return eDecl;
    }

    return null;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:30,代码来源:SubstitutionGroupHandler.java

示例3: substitutionGroupOK

protected boolean substitutionGroupOK(XSElementDecl element, XSElementDecl exemplar, short blockingConstraint) {
    // For an element declaration (call it D) to be validly substitutable for another element declaration (call it C) subject to a blocking constraint (a subset of {substitution, extension, restriction}, the value of a {disallowed substitutions}) one of the following must be true:
    // 1. D and C are the same element declaration.
    if (element == exemplar) {
        return true;
    }
    
    // 2 All of the following must be true:
    // 2.1 The blocking constraint does not contain substitution.
    if ((blockingConstraint & XSConstants.DERIVATION_SUBSTITUTION) != 0) {
        return false;
    }

    // 2.2 There is a chain of {substitution group affiliation}s from D to C, that is, either D's {substitution group affiliation} is C, or D's {substitution group affiliation}'s {substitution group affiliation} is C, or . . .
    XSElementDecl subGroup = element.fSubGroup;
    while (subGroup != null && subGroup != exemplar) {
        subGroup = subGroup.fSubGroup;
    }

    if (subGroup == null) {
        return false;
    }

    // 2.3 The set of all {derivation method}s involved in the derivation of D's {type definition} from C's {type definition} does not intersect with the union of the blocking constraint, C's {prohibited substitutions} (if C is complex, otherwise the empty set) and the {prohibited substitutions} (respectively the empty set) of any intermediate {type definition}s in the derivation of D's {type definition} from C's {type definition}.
    // prepare the combination of {derivation method} and
    // {disallowed substitution}
    return typeDerivationOK(element.fType, exemplar.fType, blockingConstraint);   
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:28,代码来源:SubstitutionGroupHandler.java

示例4: getSubstitutionGroup

/**
 * get all elements that can substitute the given element,
 * according to the spec, we shouldn't consider the {block} constraints.
 *
 * from the spec, substitution group of a given element decl also contains
 * the element itself. but the array returned from this method doesn't
 * containt this element.
 */
public XSElementDecl[] getSubstitutionGroup(XSElementDecl element) {
    // If we already have sub group for this element, just return it.
    Object subGroup = fSubGroups.get(element);
    if (subGroup != null)
        return (XSElementDecl[])subGroup;
    
    if ((element.fBlock & XSConstants.DERIVATION_SUBSTITUTION) != 0) {
        fSubGroups.put(element, EMPTY_GROUP);
        return EMPTY_GROUP;
    }
    
    // Otherwise, get all potential sub group elements
    // (without considering "block" on this element
    OneSubGroup[] groupB = getSubGroupB(element, new OneSubGroup());
    int len = groupB.length, rlen = 0;
    XSElementDecl[] ret = new XSElementDecl[len];
    // For each of such elements, check whether the derivation methods
    // overlap with "block". If not, add it to the sub group
    for (int i = 0 ; i < len; i++) {
        if ((element.fBlock & groupB[i].dMethod) == 0)
            ret[rlen++] = groupB[i].sub;
    }
    // Resize the array if necessary
    if (rlen < len) {
        XSElementDecl[] ret1 = new XSElementDecl[rlen];
        System.arraycopy(ret, 0, ret1, 0, rlen);
        ret = ret1;
    }
    // Store the subgroup
    fSubGroups.put(element, ret);

    return ret;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:41,代码来源:SubstitutionGroupHandler.java

示例5: createAnnotationElementDecl

private XSElementDecl createAnnotationElementDecl(String localName) {
    XSElementDecl eDecl = new XSElementDecl();
    eDecl.fName = localName;
    eDecl.fTargetNamespace = fTargetNamespace;
    eDecl.setIsGlobal();
    eDecl.fBlock = (XSConstants.DERIVATION_EXTENSION | 
            XSConstants.DERIVATION_RESTRICTION | XSConstants.DERIVATION_SUBSTITUTION);
    eDecl.setConstraintType(XSConstants.VC_NONE);
    return eDecl;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:10,代码来源:SchemaGrammar.java

示例6: translateBlockOrFinal

private String translateBlockOrFinal(short val) {
    String ret = "";
    if ((val & XSConstants.DERIVATION_EXTENSION) != 0) {
        ret += SchemaSymbols.ATTVAL_EXTENSION;
    }
    if ((val & XSConstants.DERIVATION_LIST) != 0) {
        if (ret.length() != 0)
            ret += " ";
        ret += SchemaSymbols.ATTVAL_LIST;
    }
    if ((val & XSConstants.DERIVATION_RESTRICTION) != 0) {
        if (ret.length() != 0)
            ret += " ";
        ret += SchemaSymbols.ATTVAL_RESTRICTION;
    }
    if ((val & XSConstants.DERIVATION_UNION) != 0) {
        if (ret.length() != 0)
            ret += " ";
        ret += SchemaSymbols.ATTVAL_UNION;
    }
    if ((val & XSConstants.DERIVATION_SUBSTITUTION) != 0) {
        if (ret.length() != 0)
            ret += " ";
        ret += SchemaSymbols.ATTVAL_SUBSTITUTION;
    }
    return ret;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:27,代码来源:PSVIWriter.java


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