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


Java XSTypeDefinition.getTypeCategory方法代码示例

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


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

示例1: checkComplexType

import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的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.XSTypeDefinition; //导入方法依赖的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: getDBMethods

import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的package包/类
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:AaronZhangL,项目名称:SplitCharater,代码行数:26,代码来源:SubstitutionGroupHandler.java

示例4: checkSimpleDerivationOk

import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的package包/类
/**
 * check whether simple type derived is valid derived from base,
 * given a subset of {restriction, extension}.
 */
public static boolean checkSimpleDerivationOk(XSSimpleType derived, XSTypeDefinition base, short block) {
    // if derived is anySimpleType, then it's valid only if the base
    // is ur-type
    if (derived == SchemaGrammar.fAnySimpleType) {
        return (base == SchemaGrammar.fAnyType ||
                base == SchemaGrammar.fAnySimpleType);
    }

    // if base is complex type
    if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
        // if base is anyType, change base to anySimpleType,
        // otherwise, not valid
        if (base == SchemaGrammar.fAnyType)
            base = SchemaGrammar.fAnySimpleType;
        else
            return false;
    }
    return checkSimpleDerivation((XSSimpleType)derived,
            (XSSimpleType)base, block);
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:25,代码来源:XSConstraints.java

示例5: processPSVITypeDefinitionRef

import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的package包/类
private void processPSVITypeDefinitionRef(
    String enclose,
    XSTypeDefinition type) {
    if (type == null) {
    	sendElementEvent(enclose);
        return;
    }

    sendIndentedElement(enclose);
    if (type.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
        processPSVIElementRef("psv:complexTypeDefinition", type);
    }
    else if (type.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
        processPSVIElementRef("psv:simpleTypeDefinition", type);
    }
    else {
        throw new IllegalArgumentException(
            "Unknown type definition value: " + type.getTypeCategory());
    }
    sendUnIndentedElement(enclose);
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:22,代码来源:PSVIWriter.java

示例6: checkNotationType

import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的package包/类
/**
 * Element/Attribute traversers call this method to check whether
 * the type is NOTATION without enumeration facet
 */
void checkNotationType(String refName, XSTypeDefinition typeDecl, Element elem) {
    if (typeDecl.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE &&
            ((XSSimpleType)typeDecl).getVariety() == XSSimpleType.VARIETY_ATOMIC &&
            ((XSSimpleType)typeDecl).getPrimitiveKind() == XSSimpleType.PRIMITIVE_NOTATION) {
        if ((((XSSimpleType)typeDecl).getDefinedFacets() & XSSimpleType.FACET_ENUMERATION) == 0) {
            reportSchemaError("enumeration-required-notation", new Object[]{typeDecl.getName(), refName, DOMUtil.getLocalName(elem)}, elem);
        }
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:14,代码来源:XSDAbstractTraverser.java

示例7: checkTypeDerivationOk

import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的package包/类
/**
 * check whether derived is valid derived from base, given a subset
 * of {restriction, extension}.B
 */
public static boolean checkTypeDerivationOk(XSTypeDefinition derived, XSTypeDefinition base, short block) {
    // if derived is anyType, then it's valid only if base is anyType too
    if (derived == SchemaGrammar.fAnyType)
        return derived == base;
    // if derived is anySimpleType, then it's valid only if the base
    // is ur-type
    if (derived == SchemaGrammar.fAnySimpleType) {
        return (base == SchemaGrammar.fAnyType ||
                base == SchemaGrammar.fAnySimpleType);
    }

    // if derived is simple type
    if (derived.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
        // if base is complex type
        if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
            // if base is anyType, change base to anySimpleType,
            // otherwise, not valid
            if (base == SchemaGrammar.fAnyType)
                base = SchemaGrammar.fAnySimpleType;
            else
                return false;
        }
        return checkSimpleDerivation((XSSimpleType)derived,
                (XSSimpleType)base, block);
    } 
    else {
        return checkComplexDerivation((XSComplexTypeDecl)derived, base, block);
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:34,代码来源:XSConstraints.java

示例8: itemByName

import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的package包/类
/**
 * Retrieves an <code>XSObject</code> specified by local name and namespace
 * URI.
 * @param namespace The namespace URI of the <code>XSObject</code> to
 *   retrieve.
 * @param localName The local name of the <code>XSObject</code> to retrieve.
 * @return A <code>XSObject</code> (of any type) with the specified local
 *   name and namespace URI, or <code>null</code> if they do not
 *   identify any <code>XSObject</code> in this map.
 */
public XSObject itemByName(String namespace, String localName) {
    for (int i = 0; i < fNSNum; i++) {
        if (isEqual(namespace, fNamespaces[i])) {
            XSTypeDefinition type = (XSTypeDefinition)fMaps[i].get(localName);
            // only return it if it matches the required type
            if (type != null && type.getTypeCategory() == fType) {
                return type;
            }
            return null;
        }
    }
    return null;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:24,代码来源:XSNamedMap4Types.java

示例9: handleContent

import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的package包/类
protected void handleContent(XSTypeDefinition type, boolean nillable, Object actualValue, short valueType, ShortList itemValueType) {
    if (type == null || 
       type.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE &&
       ((XSComplexTypeDefinition) type).getContentType()
        != XSComplexTypeDefinition.CONTENTTYPE_SIMPLE) {

            // the content must be simpleType content
            fStore.reportError( "cvc-id.3", new Object[] {
                    fIdentityConstraint.getName(),
                    fIdentityConstraint.getElementName()});
        
    }
    fMatchedString = actualValue;
    matched(fMatchedString, valueType, itemValueType, nillable);
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:16,代码来源:Field.java

示例10: processPSVITypeDefinition

import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的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

示例11: handleElementContents

import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的package包/类
public void handleElementContents(XSElementDeclaration elementDeclaration, N node) throws SAXException {
	XSTypeDefinition typeDefinition = elementDeclaration.getTypeDefinition();
	if (typeDefinition==null) {
		log.warn("handleElementContents typeDefinition is null");
		handleSimpleTypedElement(elementDeclaration, null, node);
		return;
	}
	switch (typeDefinition.getTypeCategory()) {
	case XSTypeDefinition.SIMPLE_TYPE:
		if (DEBUG) log.debug("handleElementContents typeDefinition.typeCategory is SimpleType, no child elements");
		handleSimpleTypedElement(elementDeclaration, (XSSimpleTypeDefinition)typeDefinition, node);
		return;
	case XSTypeDefinition.COMPLEX_TYPE:
		XSComplexTypeDefinition complexTypeDefinition=(XSComplexTypeDefinition)typeDefinition;
		switch (complexTypeDefinition.getContentType()) {
		case XSComplexTypeDefinition.CONTENTTYPE_EMPTY:
			if (DEBUG) log.debug("handleElementContents complexTypeDefinition.contentType is Empty, no child elements");
			return;
		case XSComplexTypeDefinition.CONTENTTYPE_SIMPLE:
			if (DEBUG) log.debug("handleElementContents complexTypeDefinition.contentType is Simple, no child elements (only characters)");
			return;
		case XSComplexTypeDefinition.CONTENTTYPE_ELEMENT:
		case XSComplexTypeDefinition.CONTENTTYPE_MIXED:
			handleComplexTypedElement(elementDeclaration,node);
			return;
		default:
			throw new IllegalStateException("handleElementContents complexTypeDefinition.contentType is not Empty,Simple,Element or Mixed, but ["+complexTypeDefinition.getContentType()+"]");
		}
	default:
		throw new IllegalStateException("handleElementContents typeDefinition.typeCategory is not SimpleType or ComplexType, but ["+typeDefinition.getTypeCategory()+"] class ["+typeDefinition.getClass().getName()+"]");
	}
}
 
开发者ID:ibissource,项目名称:iaf,代码行数:33,代码来源:ToXml.java

示例12: dumpElement

import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的package包/类
private static void dumpElement(String path, XSElementDeclaration element)
   {
      String output_path = "" + path + "/" + element.getName();

      XSTypeDefinition type = element.getTypeDefinition();

      if (type.getName().endsWith("Array"))
      {
//         System.err.println(element.getName() + " - " + type.getName()
//            + " SKIPPED !");
         return;
      }

      if (((type.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE)
            || ((XSComplexTypeDefinition) type)
            .getContentType() == XSComplexTypeDefinition.CONTENTTYPE_SIMPLE))
      {
         if (includesBaseType(type, "string")
               || includesBaseType(type, "integer")
               || includesBaseType(type, "boolean"))
         {
//            System.out.println("         <metadata name=\"" +
// element.getName() + "\" type=\"text/plain\" category=\"\">");
//            System.out.println("            " +
// indexedName(element.getName())
//               + " { local:values($doc" + output_path + ") }");
//            System.out.println("         </metadata>,");

            System.out.println("         local:getMetadata('" +
                  element.getName() + "', '" +
                  indexedName(element.getName()) + "',");
            System.out.println("            $doc" + output_path + "),");
         }
      }
      else
      {
         dumpParticle(output_path,
               ((XSComplexTypeDefinition)type).getParticle());
      }

   }
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:42,代码来源:SentinelXsdDumpMetadata.java

示例13: typeDerivationOK

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

示例14: findDTValidator

import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的package包/类
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:AaronZhangL,项目名称:SplitCharater,代码行数:43,代码来源:XSDSimpleTypeTraverser.java

示例15: checkComplexDerivation

import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的package包/类
/**
 * Note: this will be a private method, and it assumes that derived is not
 *       anyType. Another method will be introduced for public use,
 *       which will call this method.
 */
private static boolean checkComplexDerivation(XSComplexTypeDecl derived, XSTypeDefinition base, short block) {
    // 2.1 B and D must be the same type definition.
    if (derived == base)
        return true;

    // 1 If B and D are not the same type definition, then the {derivation method} of D must not be in the subset.
    if ((derived.fDerivedBy & block) != 0)
        return false;

    // 2 One of the following must be true:
    XSTypeDefinition directBase = derived.fBaseType;
    // 2.2 B must be D's {base type definition}.
    if (directBase == base)
        return true;

    // 2.3 All of the following must be true:
    // 2.3.1 D's {base type definition} must not be the ur-type definition.
    if (directBase == SchemaGrammar.fAnyType ||
            directBase == SchemaGrammar.fAnySimpleType) {
        return false;
    }

    // 2.3.2 The appropriate case among the following must be true:
    // 2.3.2.1 If D's {base type definition} is complex, then it must be validly derived from B given the subset as defined by this constraint.
    if (directBase.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE)
        return checkComplexDerivation((XSComplexTypeDecl)directBase, base, block);

    // 2.3.2.2 If D's {base type definition} is simple, then it must be validly derived from B given the subset as defined in Type Derivation OK (Simple) (3.14.6).
    if (directBase.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
        // if base is complex type
        if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
            // if base is anyType, change base to anySimpleType,
            // otherwise, not valid
            if (base == SchemaGrammar.fAnyType)
                base = SchemaGrammar.fAnySimpleType;
            else
                return false;
        }
        return checkSimpleDerivation((XSSimpleType)directBase,
                (XSSimpleType)base, block);
    }

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


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