本文整理汇总了Java中org.apache.xerces.xs.XSTypeDefinition类的典型用法代码示例。如果您正苦于以下问题:Java XSTypeDefinition类的具体用法?Java XSTypeDefinition怎么用?Java XSTypeDefinition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XSTypeDefinition类属于org.apache.xerces.xs包,在下文中一共展示了XSTypeDefinition类的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: getSimpleTypesString
import org.apache.xerces.xs.XSTypeDefinition; //导入依赖的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: findReference
import org.apache.xerces.xs.XSTypeDefinition; //导入依赖的package包/类
/**
* Finds all the element and complexType references for the specified root element and populates a map entry with
* element names referenced by the element.
*
* @param elementDeclaration XSElementDeclaration : the root element
*/
private void findReference(XSElementDeclaration elementDeclaration) {
String elemName = elementDeclaration.getName();
String thisContext = elemName;
XSTypeDefinition typeDefinition = elementDeclaration.getTypeDefinition();
if (null != typeDefinition) {
String typeDefName = typeDefinition.getName();
currentNodeNames.clear();
currentNodeNames.add(elementDeclaration.getName());
if (typeDefinition instanceof XSComplexTypeDefinition) {
addToSchemaMap(elemName, typeDefName);
if (null != typeDefName) {
thisContext = typeDefName;
}
XSParticle particle = ((XSComplexTypeDefinition) typeDefinition).getParticle();
findReferenceInParticle(thisContext, particle);
}
else {
addToSchemaMap(elemName, typeDefName);
if (null != typeDefName) {
thisContext = typeDefName;
}
}
}
}
示例5: endElement
import org.apache.xerces.xs.XSTypeDefinition; //导入依赖的package包/类
public void endElement(QName element, Augmentations augs)
throws XNIException {
final Node currentElement = fDOMValidatorHelper.getCurrentElement();
// Write type information to this element
if (augs != null && fDocumentImpl != null) {
ElementPSVI elementPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
if (elementPSVI != null) {
if (fStorePSVI) {
((PSVIElementNSImpl) currentElement).setPSVI(elementPSVI);
}
XSTypeDefinition type = elementPSVI.getMemberTypeDefinition();
if (type == null) {
type = elementPSVI.getTypeDefinition();
}
((ElementNSImpl) currentElement).setType(type);
}
}
}
示例6: endElement
import org.apache.xerces.xs.XSTypeDefinition; //导入依赖的package包/类
public void endElement(QName element, Augmentations augs)
throws XNIException {
// write type information to this element
if (augs != null && fDocumentImpl != null) {
ElementPSVI elementPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
if (elementPSVI != null) {
if (fStorePSVI) {
((PSVIElementNSImpl)fCurrentNode).setPSVI(elementPSVI);
}
XSTypeDefinition type = elementPSVI.getMemberTypeDefinition();
if (type == null) {
type = elementPSVI.getTypeDefinition();
}
((ElementNSImpl)fCurrentNode).setType(type);
}
}
// adjust current node reference
if (fCurrentNode == fFragmentRoot) {
fCurrentNode = null;
fFragmentRoot = null;
return;
}
fCurrentNode = fCurrentNode.getParentNode();
}
示例7: isDerivedByRestriction
import org.apache.xerces.xs.XSTypeDefinition; //导入依赖的package包/类
/**
* DOM Level 3
* 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 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, XSTypeDefinition type) {
XSTypeDefinition oldType = null;
while (type != null && type != oldType) {
if ((ancestorName.equals(type.getName()))
&& ((ancestorNS != null && ancestorNS.equals(type.getNamespace()))
|| (type.getNamespace() == null && ancestorNS == null))) {
return true;
}
oldType = type;
type = type.getBaseType();
}
return false;
}
示例8: isDerivedByList
import org.apache.xerces.xs.XSTypeDefinition; //导入依赖的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;
}
示例9: isDerivedByUnion
import org.apache.xerces.xs.XSTypeDefinition; //导入依赖的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;
}
示例10: 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;
}
示例11: expandRelatedComponents
import org.apache.xerces.xs.XSTypeDefinition; //导入依赖的package包/类
private void expandRelatedComponents(XSObject component, Vector componentList, Hashtable dependencies) {
short componentType = component.getType();
switch (componentType) {
case XSConstants.TYPE_DEFINITION :
expandRelatedTypeComponents((XSTypeDefinition) component, componentList, component.getNamespace(), dependencies);
break;
case XSConstants.ATTRIBUTE_DECLARATION :
expandRelatedAttributeComponents((XSAttributeDeclaration) component, componentList, component.getNamespace(), dependencies);
break;
case XSConstants.ATTRIBUTE_GROUP :
expandRelatedAttributeGroupComponents((XSAttributeGroupDefinition) component, componentList, component.getNamespace(), dependencies);
case XSConstants.ELEMENT_DECLARATION :
expandRelatedElementComponents((XSElementDeclaration) component, componentList, component.getNamespace(), dependencies);
break;
case XSConstants.MODEL_GROUP_DEFINITION :
expandRelatedModelGroupDefinitionComponents((XSModelGroupDefinition) component, componentList, component.getNamespace(), dependencies);
case XSConstants.ATTRIBUTE_USE :
//expandRelatedAttributeUseComponents((XSAttributeUse)component, componentList, dependencies);
case XSConstants.NOTATION_DECLARATION :
case XSConstants.IDENTITY_CONSTRAINT :
default :
break;
}
}
示例12: expandRelatedSimpleTypeComponents
import org.apache.xerces.xs.XSTypeDefinition; //导入依赖的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);
}
}
}
示例13: contentRestore
import org.apache.xerces.xs.XSTypeDefinition; //导入依赖的package包/类
private void contentRestore() {
fAnnotations = (XSAnnotationImpl [])fGlobalStore[--fGlobalStorePos];
fXSSimpleType = (XSSimpleType)fGlobalStore[--fGlobalStorePos];
fParticle = (XSParticleDecl)fGlobalStore[--fGlobalStorePos];
fAttrGrp = (XSAttributeGroupDecl)fGlobalStore[--fGlobalStorePos];
fBaseType = (XSTypeDefinition)fGlobalStore[--fGlobalStorePos];
int i = ((Integer)(fGlobalStore[--fGlobalStorePos])).intValue();
fBlock = (short)(i >> 16);
fContentType = (short)i;
i = ((Integer)(fGlobalStore[--fGlobalStorePos])).intValue();
fDerivedBy = (short)(i >> 16);
fFinal = (short)i;
fTargetNamespace = (String)fGlobalStore[--fGlobalStorePos];
fName = (String)fGlobalStore[--fGlobalStorePos];
fIsAbstract = ((Boolean)fGlobalStore[--fGlobalStorePos]).booleanValue();
fComplexTypeDecl = (XSComplexTypeDecl)fGlobalStore[--fGlobalStorePos];
}
示例14: 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);
}
示例15: setValues
import org.apache.xerces.xs.XSTypeDefinition; //导入依赖的package包/类
public void setValues(String name, String targetNamespace,
XSTypeDefinition baseType, short derivedBy, short schemaFinal,
short block, short contentType,
boolean isAbstract, XSAttributeGroupDecl attrGrp,
XSSimpleType simpleType, XSParticleDecl particle,
XSObjectListImpl annotations) {
fTargetNamespace = targetNamespace;
fBaseType = baseType;
fDerivedBy = derivedBy;
fFinal = schemaFinal;
fBlock = block;
fContentType = contentType;
if(isAbstract)
fMiscFlags |= CT_IS_ABSTRACT;
fAttrGrp = attrGrp;
fXSSimpleType = simpleType;
fParticle = particle;
fAnnotations = annotations;
}