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


Java XSSimpleTypeDefinition类代码示例

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


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

示例1: checkComplexType

import org.apache.xerces.xs.XSSimpleTypeDefinition; //导入依赖的package包/类
public static boolean checkComplexType(XSTypeDefinition td) {
    if (td.getTypeCategory() != XSTypeDefinition.COMPLEX_TYPE) {
        return false;
    }
    XSComplexTypeDefinition ctd = (XSComplexTypeDefinition) td;
    if (ctd.getContentType() == XSComplexTypeDefinition.CONTENTTYPE_ELEMENT) {
        return true;
    }
    if ((td instanceof XSComplexTypeDecl) && ((XSComplexTypeDecl) td).getAbstract()) {
        return true;
    }
    if (TEXT_ELEMENTS_ARE_COMPLEX) {
        return true;
    }
    if (ctd.getAttributeUses() != null) {
        for (int i = 0; i < ctd.getAttributeUses().getLength(); i++) {
            XSSimpleTypeDefinition xsstd = ((XSAttributeUse) ctd.getAttributeUses().item(i)).getAttrDeclaration()
                                                                                            .getTypeDefinition();
            if ("ID".equals(xsstd.getName())) {
                continue;
            }
            return true;
        }
    }
    return false;
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:27,代码来源:XSDModelLoader.java

示例2: checkBooleanType

import org.apache.xerces.xs.XSSimpleTypeDefinition; //导入依赖的package包/类
private static boolean checkBooleanType(XSTypeDefinition td) {
    if (td.getTypeCategory() != XSTypeDefinition.SIMPLE_TYPE) {
        return false;
    }
    final XSSimpleTypeDefinition st = ((XSSimpleTypeDefinition) td);
    final XSObjectList facets = st.getFacets();
    for (int i = 0; i < facets.getLength(); i++) {
        final XSFacet facet = (XSFacet) facets.item(i);
        if (facet.getFacetKind() == XSSimpleTypeDefinition.FACET_LENGTH) {
            if ("0".equals(facet.getLexicalFacetValue())) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:17,代码来源:XSDModelLoader.java

示例3: getSimpleTypesString

import org.apache.xerces.xs.XSSimpleTypeDefinition; //导入依赖的package包/类
private static String getSimpleTypesString(XSTypeDefinition et) {
    StringBuffer typesHierarchy = new StringBuffer();
    while (et != null && !"anySimpleType".equals(et.getName()) && !"anyType".equals(et.getName()) && et.getNamespace() != null) {
        typesHierarchy.append(et.getNamespace().substring(et.getNamespace().lastIndexOf("/") + 1))
                      .append(":")
                      .append(et.getName())
                      .append(";");
        if (et instanceof XSSimpleType) {
            XSSimpleType simpleType = (XSSimpleType) et;
            if (simpleType.getVariety() == XSSimpleTypeDefinition.VARIETY_LIST
                || simpleType.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION) {
                XSObjectList list = simpleType.getMemberTypes();
                if (list.getLength() > 0) {
                    typesHierarchy.append("{");
                    for (int i = 0; i < list.getLength(); i++) {
                        typesHierarchy.append(getSimpleTypesString((XSTypeDefinition) list.item(i)));
                    }
                    typesHierarchy.append("}");
                }
            }
        }
        et = et.getBaseType();
    }
    return typesHierarchy.toString();
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:26,代码来源:XSDModelLoader.java

示例4: setPSVI

import org.apache.xerces.xs.XSSimpleTypeDefinition; //导入依赖的package包/类
/**
 * Copy PSVI properties from another psvi item.
 * 
 * @param elem  the source of element PSVI items
 */
public void setPSVI(ElementPSVI elem) {
    this.fDeclaration = elem.getElementDeclaration();
    this.fNotation = elem.getNotation();
    this.fValidationContext = elem.getValidationContext();
    this.fTypeDecl = elem.getTypeDefinition();
    this.fSchemaInformation = elem.getSchemaInformation();
    this.fValidity = elem.getValidity();
    this.fValidationAttempted = elem.getValidationAttempted();
    this.fErrorCodes = elem.getErrorCodes();
    this.fErrorMessages = elem.getErrorMessages();
    if (fTypeDecl instanceof XSSimpleTypeDefinition ||
            fTypeDecl instanceof XSComplexTypeDefinition &&
            ((XSComplexTypeDefinition)fTypeDecl).getContentType() == XSComplexTypeDefinition.CONTENTTYPE_SIMPLE) {
        this.fValue.copyFrom(elem.getSchemaValue());
    }
    else {
        this.fValue.reset();
    }
    this.fSpecified = elem.getIsSchemaSpecified();
    this.fNil = elem.getNil();
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:27,代码来源:PSVIElementNSImpl.java

示例5: isDerivedByList

import org.apache.xerces.xs.XSSimpleTypeDefinition; //导入依赖的package包/类
/**
 * Checks if a type is derived from another by list. 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 list for the reference type
 */    
private boolean isDerivedByList (String ancestorNS, String ancestorName, XSTypeDefinition type) {
    // If the variety is union
    if (type !=null && ((XSSimpleTypeDefinition)type).getVariety() == VARIETY_LIST) {

        // get the {item type}
        XSTypeDefinition itemType = ((XSSimpleTypeDefinition)type).getItemType();

        // T2 is the {item type definition}
        if (itemType != null) {

            // T2 is derived from the other type definition by DERIVATION_RESTRICTION
            if (isDerivedByRestriction(ancestorNS, ancestorName, itemType)) {
                return true;
            } 
        }
    }
    return false;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:32,代码来源:XSSimpleTypeDecl.java

示例6: isDerivedByUnion

import org.apache.xerces.xs.XSSimpleTypeDefinition; //导入依赖的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:AaronZhangL,项目名称:SplitCharater,代码行数:34,代码来源:XSSimpleTypeDecl.java

示例7: expandRelatedSimpleTypeComponents

import org.apache.xerces.xs.XSSimpleTypeDefinition; //导入依赖的package包/类
private void expandRelatedSimpleTypeComponents(XSSimpleTypeDefinition type, Vector componentList, String namespace, Hashtable dependencies) {
    final XSTypeDefinition baseType = type.getBaseType();
    if (baseType != null) {
        addRelatedType(baseType, componentList, namespace, dependencies);
    }

    final XSTypeDefinition itemType = type.getItemType();
    if (itemType != null) {
        addRelatedType(itemType, componentList, namespace, dependencies);
    }
    
    final XSTypeDefinition primitiveType = type.getPrimitiveType();
    if (primitiveType != null) {
        addRelatedType(primitiveType, componentList, namespace, dependencies);
    }

    final XSObjectList memberTypes = type.getMemberTypes();
    if (memberTypes.size() > 0) {
        for (int i=0; i<memberTypes.size(); i++) {
            addRelatedType((XSTypeDefinition)memberTypes.item(i), componentList, namespace, dependencies);
        }
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:24,代码来源:XSDHandler.java

示例8: processEnumType

import org.apache.xerces.xs.XSSimpleTypeDefinition; //导入依赖的package包/类
public void processEnumType(
    XSTypeDefinition def,
    Map<String, TypeDesc> jtMap,
    Map<String, NamespaceDesc> nsdMap
) throws Exception {
    boolean complexType = def instanceof XSComplexTypeDefinition;
    if (!nsdMap.containsKey(def.getNamespace())) {
        Util.log("Namespace desc not found for: " + def);
    }
    final String typeName = toJavaTypeName(def, nsdMap);
    final TypeDesc td = new TypeDesc(def.getName(), def.getNamespace(), typeName, TypeDesc.TypeEnum.ENUM);
    final XSComplexTypeDefinition ct = complexType ? (XSComplexTypeDefinition) def : null;
    final XSSimpleTypeDefinition st = (XSSimpleTypeDefinition) (complexType
                                                                    ? ((XSComplexTypeDefinition) def).getSimpleType()
                                                                    : def);
    for (int i = 0; i < st.getLexicalEnumeration().getLength(); i++) {
        final String s = st.getLexicalEnumeration().item(i);
        td.fdMap.put(s, new FieldDesc(Util.computeEnumConstantName(s, td.name), s));
    }

    final XSObjectList anns = complexType ? ct.getAnnotations() : st.getAnnotations();

    td.documentation = parseAnnotationString(
        "Enumeration " + def.getNamespace() + ":" + def.getName() + " documentation",
        anns != null && anns.getLength() > 0
            ? ((XSAnnotation) anns.item(0)).getAnnotationString()
            : null
    );
    jtMap.put(model.toJavaQualifiedTypeName(def, nsdMap, true), td);
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:31,代码来源:XSDModelLoader.java

示例9: getSimpleDatatypeFor

import org.apache.xerces.xs.XSSimpleTypeDefinition; //导入依赖的package包/类
public static Datatype getSimpleDatatypeFor(String schemaAsString,
		String typeName, String typeURI) throws EXIException {
	XSDGrammarsBuilder xsdGB = XSDGrammarsBuilder.newInstance();
	ByteArrayInputStream bais = new ByteArrayInputStream(
			schemaAsString.getBytes());
	xsdGB.loadGrammars(bais);
	xsdGB.toGrammars();

	XSModel xsModel = xsdGB.getXSModel();

	XSTypeDefinition td = xsModel.getTypeDefinition(typeName, typeURI);

	assertTrue("SimpleType expected",
			td.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE);

	Datatype dt = xsdGB.getDatatype((XSSimpleTypeDefinition) td);

	return dt;
}
 
开发者ID:EXIficient,项目名称:exificient,代码行数:20,代码来源:DatatypeMappingTest.java

示例10: manageSimpleTypeElement

import org.apache.xerces.xs.XSSimpleTypeDefinition; //导入依赖的package包/类
private void manageSimpleTypeElement(IXSDNode currentNode, XSParticleDecl fatherParticle, XSElementDecl currentElementDeclaration) {
    XSSimpleTypeDefinition simpleTypeDefinition = (XSSimpleTypeDefinition) currentElementDeclaration.getTypeDefinition();
    if (logger.isDebugEnabled()) logger.debug("Found a simple type: " + currentElementDeclaration.getName() + " with type: " + simpleTypeDefinition.getBuiltInKind());
    SimpleType simpleType = new SimpleType(getLeafType(simpleTypeDefinition.getBuiltInKind()));
    currentNode.addChild(simpleType);
    setCardinality(currentNode, fatherParticle);
}
 
开发者ID:dbunibas,项目名称:spicy,代码行数:8,代码来源:GenerateXSDNodeTree.java

示例11: processAttribute

import org.apache.xerces.xs.XSSimpleTypeDefinition; //导入依赖的package包/类
private void processAttribute(Path parent, String path, XSAttributeUse xsAttribute) throws BagriException {
  	
   path += "/@" + xsAttribute.getAttrDeclaration().getName();
   XSSimpleTypeDefinition std = xsAttribute.getAttrDeclaration().getTypeDefinition();
   Occurrence occurrence = Occurrence.getOccurrence(
   		xsAttribute.getRequired() ? 1 : 0,
   		std.getVariety() == XSSimpleTypeDefinition.VARIETY_LIST ? -1 : 1);
Path xp = modelMgr.translatePath(parent.getRoot(), path, NodeKind.attribute, parent.getPathId(), getBaseType(std), occurrence);
logger.trace("processAttribute; attribute: {}; type: {}; got XDMPath: {}", path, std, xp); 
  }
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:11,代码来源:XmlModeler.java

示例12: getPrimitiveType

import org.apache.xerces.xs.XSSimpleTypeDefinition; //导入依赖的package包/类
/**
 * If variety is <code>atomic</code> the primitive type definition (a
 * built-in primitive datatype definition or the simple ur-type
 * definition) is available, otherwise <code>null</code>.
 */
public XSSimpleTypeDefinition getPrimitiveType() {
    if (fVariety == VARIETY_ATOMIC && fValidationDV != DV_ANYSIMPLETYPE) {
        XSSimpleTypeDecl pri = this;
        // recursively get base, until we reach anySimpleType
        while (pri.fBase != fAnySimpleType)
            pri = pri.fBase;
        return pri;
    }
    else {
        // REVISIT: error situation. runtime exception?
        return null;
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:19,代码来源:XSSimpleTypeDecl.java

示例13: getItemType

import org.apache.xerces.xs.XSSimpleTypeDefinition; //导入依赖的package包/类
/**
 * If variety is <code>list</code> the item type definition (an atomic or
 * union simple type definition) is available, otherwise
 * <code>null</code>.
 */
public XSSimpleTypeDefinition getItemType() {
    if (fVariety == VARIETY_LIST) {
        return fItemType;
    }
    else {
        // REVISIT: error situation. runtime exception?
        return null;
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:15,代码来源:XSSimpleTypeDecl.java

示例14: expandRelatedTypeComponents

import org.apache.xerces.xs.XSSimpleTypeDefinition; //导入依赖的package包/类
private void expandRelatedTypeComponents(XSTypeDefinition type, Vector componentList, String namespace, Hashtable dependencies) {
    if (type instanceof XSComplexTypeDecl) {
        expandRelatedComplexTypeComponents((XSComplexTypeDecl) type, componentList, namespace, dependencies);
    }
    else if (type instanceof XSSimpleTypeDecl) {
        expandRelatedSimpleTypeComponents((XSSimpleTypeDefinition) type, componentList, namespace, dependencies);
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:9,代码来源:XSDHandler.java

示例15: processPSVITypeDefinition

import org.apache.xerces.xs.XSSimpleTypeDefinition; //导入依赖的package包/类
private void processPSVITypeDefinition(XSTypeDefinition type) {
    if (type == null)
        return;
    if (type.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
        processPSVIComplexTypeDefinition((XSComplexTypeDefinition)type);
    }
    else if (type.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
        processPSVISimpleTypeDefinition((XSSimpleTypeDefinition)type);
    }
    else {
        throw new IllegalArgumentException(
            "Unknown type definition value: " + type.getType());
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:15,代码来源:PSVIWriter.java


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