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


Java XSObjectList.getLength方法代码示例

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


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

示例1: isDerivedByUnion

import com.sun.org.apache.xerces.internal.xs.XSObjectList; //导入方法依赖的package包/类
/**
 * Checks if a type is derived from another by union.  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 type
 *            The reference type definition
 *
 * @return boolean True if the type is derived by union for the reference type
 */
private boolean isDerivedByUnion (String ancestorNS, String ancestorName, XSTypeDefinition type) {

    // If the variety is union
    if (type !=null && ((XSSimpleTypeDefinition)type).getVariety() == VARIETY_UNION) {

        // get member types
        XSObjectList memberTypes = ((XSSimpleTypeDefinition)type).getMemberTypes();

        for (int i = 0; i < memberTypes.getLength(); i++) {
            // One of the {member type definitions} is T2.
            if (memberTypes.item(i) != null) {
                // T2 is derived from the other type definition by DERIVATION_RESTRICTION
                if (isDerivedByRestriction(ancestorNS, ancestorName,(XSSimpleTypeDefinition)memberTypes.item(i))) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:XSSimpleTypeDecl.java

示例2: containsQName

import com.sun.org.apache.xerces.internal.xs.XSObjectList; //导入方法依赖的package包/类
private boolean containsQName(XSSimpleType type) {
    if (type.getVariety() == XSSimpleType.VARIETY_ATOMIC) {
        short primitive = type.getPrimitiveKind();
        return (primitive == XSSimpleType.PRIMITIVE_QNAME ||
                primitive == XSSimpleType.PRIMITIVE_NOTATION);
    }
    else if (type.getVariety() == XSSimpleType.VARIETY_LIST) {
        return containsQName((XSSimpleType)type.getItemType());
    }
    else if (type.getVariety() == XSSimpleType.VARIETY_UNION) {
        XSObjectList members = type.getMemberTypes();
        for (int i = 0; i < members.getLength(); i++) {
            if (containsQName((XSSimpleType)members.item(i)))
                return true;
        }
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:XSDAbstractTraverser.java

示例3: isListDatatype

import com.sun.org.apache.xerces.internal.xs.XSObjectList; //导入方法依赖的package包/类
private boolean isListDatatype(XSSimpleType validator) {
    if (validator.getVariety() == XSSimpleType.VARIETY_LIST)
        return true;

    if (validator.getVariety() == XSSimpleType.VARIETY_UNION) {
        XSObjectList temp = validator.getMemberTypes();
        for (int i = 0; i < temp.getLength(); i++) {
            if (((XSSimpleType)temp.item(i)).getVariety() == XSSimpleType.VARIETY_LIST) {
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:XSDSimpleTypeTraverser.java

示例4: expandRelatedModelGroupComponents

import com.sun.org.apache.xerces.internal.xs.XSObjectList; //导入方法依赖的package包/类
private void expandRelatedModelGroupComponents(XSModelGroup modelGroup, Vector componentList,
        String namespace, Map<String, Vector> dependencies) {
    XSObjectList particles = modelGroup.getParticles();
    final int length = (particles == null) ? 0 : particles.getLength();
    for (int i=0; i<length; i++) {
        expandRelatedParticleComponents((XSParticle)particles.item(i), componentList, namespace, dependencies);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:XSDHandler.java

示例5: copyFrom

import com.sun.org.apache.xerces.internal.xs.XSObjectList; //导入方法依赖的package包/类
public void copyFrom(XSValue o) {
    if (o == null) {
        reset();
    }
    else if (o instanceof ValidatedInfo) {
        ValidatedInfo other = (ValidatedInfo)o;
        normalizedValue = other.normalizedValue;
        actualValue = other.actualValue;
        actualValueType = other.actualValueType;
        actualType = other.actualType;
        memberType = other.memberType;
        memberTypes = other.memberTypes;
        itemValueTypes = other.itemValueTypes;
    }
    else {
        normalizedValue = o.getNormalizedValue();
        actualValue = o.getActualValue();
        actualValueType = o.getActualValueType();
        actualType = (XSSimpleType)o.getTypeDefinition();
        memberType = (XSSimpleType)o.getMemberTypeDefinition();
        XSSimpleType realType = memberType == null ? actualType : memberType;
        if (realType != null && realType.getBuiltInKind() == XSConstants.LISTOFUNION_DT) {
            XSObjectList members = o.getMemberTypeDefinitions();
            memberTypes = new XSSimpleType[members.getLength()];
            for (int i = 0; i < members.getLength(); i++) {
                memberTypes[i] = (XSSimpleType)members.get(i);
            }
        }
        else {
            memberTypes = null;
        }
        itemValueTypes = o.getListValueTypes();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:35,代码来源:ValidatedInfo.java

示例6: typeDerivationOK

import com.sun.org.apache.xerces.internal.xs.XSObjectList; //导入方法依赖的package包/类
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:SunburstApps,项目名称:OpenJSharp,代码行数:47,代码来源:SubstitutionGroupHandler.java

示例7: checkSimpleDerivation

import com.sun.org.apache.xerces.internal.xs.XSObjectList; //导入方法依赖的package包/类
/**
 * Note: this will be a private method, and it assumes that derived is not
 *       anySimpleType, and base is not anyType. Another method will be
 *       introduced for public use, which will call this method.
 */
private static boolean checkSimpleDerivation(XSSimpleType derived, XSSimpleType base, short block) {
    // 1 They are the same type definition.
    if (derived == base)
        return true;

    // 2 All of the following must be true:
    // 2.1 restriction is not in the subset, or in the {final} of its own {base type definition};
    if ((block & XSConstants.DERIVATION_RESTRICTION) != 0 ||
            (derived.getBaseType().getFinal() & XSConstants.DERIVATION_RESTRICTION) != 0) {
        return false;
    }

    // 2.2 One of the following must be true:
    // 2.2.1 D's base type definition is B.
    XSSimpleType directBase = (XSSimpleType)derived.getBaseType();
    if (directBase == base)
        return true;

    // 2.2.2 D's base type definition is not the simple ur-type definition and is validly derived from B given the subset, as defined by this constraint.
    if (directBase != SchemaGrammar.fAnySimpleType &&
            checkSimpleDerivation(directBase, base, block)) {
        return true;
    }

    // 2.2.3 D's {variety} is list or union and B is the simple ur-type definition.
    if ((derived.getVariety() == XSSimpleType.VARIETY_LIST ||
            derived.getVariety() == XSSimpleType.VARIETY_UNION) &&
            base == SchemaGrammar.fAnySimpleType) {
        return true;
    }

    // 2.2.4 B's {variety} is union and D is validly derived from a type definition in B's {member type definitions} given the subset, as defined by this constraint.
    if (base.getVariety() == XSSimpleType.VARIETY_UNION) {
        XSObjectList subUnionMemberDV = base.getMemberTypes();
        int subUnionSize = subUnionMemberDV.getLength();
        for (int i=0; i<subUnionSize; i++) {
            base = (XSSimpleType)subUnionMemberDV.item(i);
            if (checkSimpleDerivation(derived, base, block))
                return true;
        }
    }

    return false;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:50,代码来源:XSConstraints.java

示例8: addDefaultAttributes

import com.sun.org.apache.xerces.internal.xs.XSObjectList; //导入方法依赖的package包/类
void addDefaultAttributes(
    QName element,
    XMLAttributes attributes,
    XSAttributeGroupDecl attrGrp) {
    // Check after all specified attrs are scanned
    // (1) report error for REQUIRED attrs that are missing (V_TAGc)
    // REVISIT: should we check prohibited attributes?
    // (2) report error for PROHIBITED attrs that are present (V_TAGc)
    // (3) add default attrs (FIXED and NOT_FIXED)
    //
    if (DEBUG) {
        System.out.println("==>addDefaultAttributes: " + element);
    }
    XSObjectList attrUses = attrGrp.getAttributeUses();
    int useCount = attrUses.getLength();
    XSAttributeUseImpl currUse;
    XSAttributeDecl currDecl;
    short constType;
    ValidatedInfo defaultValue;
    boolean isSpecified;
    QName attName;
    // for each attribute use
    for (int i = 0; i < useCount; i++) {

        currUse = (XSAttributeUseImpl) attrUses.item(i);
        currDecl = currUse.fAttrDecl;
        // get value constraint
        constType = currUse.fConstraintType;
        defaultValue = currUse.fDefault;
        if (constType == XSConstants.VC_NONE) {
            constType = currDecl.getConstraintType();
            defaultValue = currDecl.fDefault;
        }
        // whether this attribute is specified
        isSpecified = attributes.getValue(currDecl.fTargetNamespace, currDecl.fName) != null;

        // Element Locally Valid (Complex Type)
        // 4 The {attribute declaration} of each attribute use in the {attribute uses} whose
        // {required} is true matches one of the attribute information items in the element
        // information item's [attributes] as per clause 3.1 above.
        if (currUse.fUse == SchemaSymbols.USE_REQUIRED) {
            if (!isSpecified)
                reportSchemaError(
                    "cvc-complex-type.4",
                    new Object[] { element.rawname, currDecl.fName });
        }
        // if the attribute is not specified, then apply the value constraint
        if (!isSpecified && constType != XSConstants.VC_NONE) {
            attName =
                new QName(null, currDecl.fName, currDecl.fName, currDecl.fTargetNamespace);
            String normalized = (defaultValue != null) ? defaultValue.stringValue() : "";
            int attrIndex;
            if (attributes instanceof XMLAttributesImpl) {
                XMLAttributesImpl attrs = (XMLAttributesImpl) attributes;
                attrIndex = attrs.getLength();
                attrs.addAttributeNS(attName, "CDATA", normalized);
            }
            else {
                attrIndex = attributes.addAttribute(attName, "CDATA", normalized);
            }

            if (fAugPSVI) {

                // PSVI: attribute is "schema" specified
                Augmentations augs = attributes.getAugmentations(attrIndex);
                AttributePSVImpl attrPSVI = new AttributePSVImpl();
                augs.putItem(Constants.ATTRIBUTE_PSVI, attrPSVI);

                attrPSVI.fDeclaration = currDecl;
                attrPSVI.fTypeDecl = currDecl.fType;
                attrPSVI.fValue.copyFrom(defaultValue);
                attrPSVI.fValidationContext = fValidationRoot;
                attrPSVI.fValidity = AttributePSVI.VALIDITY_VALID;
                attrPSVI.fValidationAttempted = AttributePSVI.VALIDATION_FULL;
                attrPSVI.fSpecified = true;
            }
        }

    } // for
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:81,代码来源:XMLSchemaValidator.java


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