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


Java XSConstants.DERIVATION_RESTRICTION属性代码示例

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


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

示例1: getDBMethods

private boolean getDBMethods(XSTypeDefinition typed, XSTypeDefinition typeb,
                             OneSubGroup methods) {
    short dMethod = 0, bMethod = 0;
    while (typed != typeb && typed != SchemaGrammar.fAnyType) {
        if (typed.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE)
            dMethod |= ((XSComplexTypeDecl)typed).fDerivedBy;
        else
            dMethod |= XSConstants.DERIVATION_RESTRICTION;
        typed = typed.getBaseType();
        // type == null means the current type is anySimpleType,
        // whose base type should be anyType
        if (typed == null)
            typed = SchemaGrammar.fAnyType;
        if (typed.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE)
            bMethod |= ((XSComplexTypeDecl)typed).fBlock;
    }
    // No derivation relation, or blocked, return false
    if (typed != typeb || (dMethod & bMethod) != 0)
        return false;
    
    // Remember the derivation methods and blocks, return true.
    methods.dMethod = dMethod;
    methods.bMethod = bMethod;
    return true;
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:25,代码来源:SubstitutionGroupHandler.java

示例2: errorType

private XSSimpleType errorType(String name, String namespace, short refType) {
    XSSimpleType stringType = (XSSimpleType)SchemaGrammar.SG_SchemaNS.getTypeDefinition("string");
    switch (refType) {
    case XSConstants.DERIVATION_RESTRICTION:
        return fSchemaHandler.fDVFactory.createTypeRestriction(name, namespace, (short)0,
                stringType, null);
    case XSConstants.DERIVATION_LIST:
        return fSchemaHandler.fDVFactory.createTypeList(name, namespace, (short)0,
                stringType, null);
    case XSConstants.DERIVATION_UNION:
        return fSchemaHandler.fDVFactory.createTypeUnion(name, namespace, (short)0,
                new XSSimpleType[]{stringType}, null);
    }
    
    return null;
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:16,代码来源:XSDSimpleTypeTraverser.java

示例3: reset

public void reset(){
    fName = null;
    fTargetNamespace = null;
    fBaseType = null;
    fDerivedBy = XSConstants.DERIVATION_RESTRICTION;
    fFinal = XSConstants.DERIVATION_NONE;
    fBlock = XSConstants.DERIVATION_NONE;

    fMiscFlags = 0;

    // reset attribute group
    fAttrGrp.reset();
    fContentType = CONTENTTYPE_EMPTY;
    fXSSimpleType = null;
    fParticle = null;
    fCMValidator = null;
    fUPACMValidator = null;
    if(fAnnotations != null) {
        // help out the garbage collector
        fAnnotations.clearXSObjectList();
    }
    fAnnotations = null;
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:23,代码来源:XSComplexTypeDecl.java

示例4: 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

示例5: XSAnyType

public XSAnyType () {
    fName = SchemaSymbols.ATTVAL_ANYTYPE;
    super.fTargetNamespace = SchemaSymbols.URI_SCHEMAFORSCHEMA;
    fBaseType = this;
    fDerivedBy = XSConstants.DERIVATION_RESTRICTION;
    fContentType = XSComplexTypeDecl.CONTENTTYPE_MIXED;

    fParticle = null;
    fAttrGrp = null;
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:10,代码来源:SchemaGrammar.java

示例6: typeDerivationOK

private boolean typeDerivationOK(XSTypeDefinition derived, XSTypeDefinition base, short blockingConstraint) {
    
    short devMethod = 0, blockConstraint = blockingConstraint;

    // "derived" should be derived from "base"
    // add derivation methods of derived types to devMethod;
    // add block of base types to blockConstraint.
    XSTypeDefinition type = derived;
    while (type != base && type != SchemaGrammar.fAnyType) {
        if (type.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
            devMethod |= ((XSComplexTypeDecl)type).fDerivedBy;
        }
        else {
            devMethod |= XSConstants.DERIVATION_RESTRICTION;
        }
        type = type.getBaseType();
        // type == null means the current type is anySimpleType,
        // whose base type should be anyType
        if (type == null) {
            type = SchemaGrammar.fAnyType;
        }
        if (type.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
            blockConstraint |= ((XSComplexTypeDecl)type).fBlock;
        }
    }
    if (type != base) {
        // If the base is a union, check if "derived" is allowed through any of the member types.
        if (base.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
            XSSimpleTypeDefinition st = (XSSimpleTypeDefinition) base;
            if (st.getVariety() ==  XSSimpleTypeDefinition.VARIETY_UNION) {
                XSObjectList memberTypes = st.getMemberTypes();
                final int length = memberTypes.getLength();
                for (int i = 0; i < length; ++i) {
                    if (typeDerivationOK(derived, (XSTypeDefinition) memberTypes.item(i), blockingConstraint)) {
                        return true;
                    }
                }
            }
        }
        return false;
    }
    if ((devMethod & blockConstraint) != 0) {
        return false;
    }
    return true;
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:46,代码来源:SubstitutionGroupHandler.java

示例7: findDTValidator

private XSSimpleType findDTValidator(Element elm, String refName,
        QName baseTypeStr, short baseRefContext,
        XSDocumentInfo schemaDoc) {
    if (baseTypeStr == null)
        return null;
    
    XSTypeDefinition baseType = (XSTypeDefinition)fSchemaHandler.getGlobalDecl(schemaDoc, XSDHandler.TYPEDECL_TYPE, baseTypeStr, elm);
    if (baseType == null) {
        return null;
    }
    if (baseType.getTypeCategory() != XSTypeDefinition.SIMPLE_TYPE) {
        reportSchemaError("cos-st-restricts.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
        return null;
    }

    // if it's a complex type, or if its restriction of anySimpleType
    if (baseType == SchemaGrammar.fAnySimpleType &&
        baseRefContext == XSConstants.DERIVATION_RESTRICTION) {
        // if the base type is anySimpleType and the current type is
        // a S4S built-in type, return null. (not an error).
        if (checkBuiltIn(refName, schemaDoc.fTargetNamespace)) {
            return null;
        }
        reportSchemaError("cos-st-restricts.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
        return null;
    }

    if ((baseType.getFinal() & baseRefContext) != 0) {
        if (baseRefContext == XSConstants.DERIVATION_RESTRICTION) {
            reportSchemaError("st-props-correct.3", new Object[]{refName, baseTypeStr.rawname}, elm);
        }
        else if (baseRefContext == XSConstants.DERIVATION_LIST) {
            reportSchemaError("cos-st-restricts.2.3.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
        }
        else if (baseRefContext == XSConstants.DERIVATION_UNION) {
            reportSchemaError("cos-st-restricts.3.3.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
        }
        return null;
    }
    
    return (XSSimpleType)baseType;
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:42,代码来源:XSDSimpleTypeTraverser.java

示例8: isDerivedByRestriction

/**
 * Checks if a type is derived from another by restriction. 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 restriciton for the
 *         reference type
 */
private boolean isDerivedByRestriction(String ancestorNS,
        String ancestorName, int derivationMethod, XSTypeDefinition type) {
    
    XSTypeDefinition oldType = null;
    while (type != null && type != oldType) {
        
        // ancestor is anySimpleType, return false
        if (ancestorNS != null
                && ancestorNS.equals(SchemaSymbols.URI_SCHEMAFORSCHEMA)
                && ancestorName.equals(SchemaSymbols.ATTVAL_ANYSIMPLETYPE)) {
            return false;
        }
        
        // if the name and namespace of this type is the same as the
        // ancestor return true
        if ((ancestorName.equals(type.getName()))
                && (ancestorNS != null && ancestorNS.equals(type.getNamespace())) 
                        || ((type.getNamespace() == null && ancestorNS == null))) {
            
            return true;
        }
        
        // 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;
            }
            return ((XSSimpleTypeDecl) type).isDOMDerivedFrom(ancestorNS,
                    ancestorName, derivationMethod);
        } else {
            // If the base type is a complex type
            // Every derivation step till the base type should be
            // restriction. If not return false
            if (((XSComplexTypeDecl) type).getDerivationMethod() != XSConstants.DERIVATION_RESTRICTION) {
                return false;
            }
        }
        oldType = type;
        type = type.getBaseType();
        
    }
    
    return false;
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:61,代码来源:XSComplexTypeDecl.java


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