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


Java XSConstants.DERIVATION_EXTENSION属性代码示例

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


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

示例1: 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:MaTriXy,项目名称:xerces-for-android,代码行数:10,代码来源:SchemaGrammar.java

示例2: isDerivedByExtension

/**
 * Checks if a type is derived from another by extension. See:
 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom
 * 
 * @param ancestorNS
 *            The namspace of the ancestor type declaration
 * @param ancestorName
 *            The name of the ancestor type declaration
 * @param derivationMethod
 *            A short indication the method of derivation
 * @param type
 *            The reference type definition
 * 
 * @return boolean True if the type is derived by extension for the
 *         reference type
 */
private boolean isDerivedByExtension(String ancestorNS,
        String ancestorName, int derivationMethod, XSTypeDefinition type) {
    
    boolean extension = false;
    XSTypeDefinition oldType = null;
    while (type != null && type != oldType) {
        // If ancestor is anySimpleType return false.
        if (ancestorNS != null
                && ancestorNS.equals(SchemaSymbols.URI_SCHEMAFORSCHEMA)
                && ancestorName.equals(SchemaSymbols.ATTVAL_ANYSIMPLETYPE)
                && SchemaSymbols.URI_SCHEMAFORSCHEMA.equals(type.getNamespace())
                        && SchemaSymbols.ATTVAL_ANYTYPE.equals(type.getName())) {
            break;
        }
        
        if ((ancestorName.equals(type.getName()))
                && ((ancestorNS == null && type.getNamespace() == null) 
                    || (ancestorNS != null && ancestorNS.equals(type.getNamespace())))) {
            // returns true if atleast one derivation step was extension
            return extension;
        }
        
        // If the base type is a complexType with simpleContent
        if (type instanceof XSSimpleTypeDecl) {
            if (ancestorNS.equals(SchemaSymbols.URI_SCHEMAFORSCHEMA)
                    && ancestorName.equals(SchemaSymbols.ATTVAL_ANYTYPE)) {
                ancestorName = SchemaSymbols.ATTVAL_ANYSIMPLETYPE;
            }
            
            // derivationMethod extension will always return false for a
            // simpleType,
            // we treat it like a restriction
            if ((derivationMethod & DERIVATION_EXTENSION) != 0) {
                return extension
                & ((XSSimpleTypeDecl) type).isDOMDerivedFrom(
                        ancestorNS, ancestorName,
                        (derivationMethod & DERIVATION_RESTRICTION));
            } else {
                return extension
                & ((XSSimpleTypeDecl) type).isDOMDerivedFrom(
                        ancestorNS, ancestorName, derivationMethod);
            }
            
        } else {
            // If the base type is a complex type
            // At least one derivation step upto the ancestor type should be
            // extension.
            if (((XSComplexTypeDecl) type).getDerivationMethod() == XSConstants.DERIVATION_EXTENSION) {
                extension = extension | true;
            }
        }
        oldType = type;
        type = type.getBaseType();
    }
    
    return false;
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:73,代码来源:XSComplexTypeDecl.java


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