本文整理汇总了Java中org.apache.xerces.xs.XSTypeDefinition.getBaseType方法的典型用法代码示例。如果您正苦于以下问题:Java XSTypeDefinition.getBaseType方法的具体用法?Java XSTypeDefinition.getBaseType怎么用?Java XSTypeDefinition.getBaseType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xerces.xs.XSTypeDefinition
的用法示例。
在下文中一共展示了XSTypeDefinition.getBaseType方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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
示例2: 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;
}
示例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;
}
示例4: derivedFromType
import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的package包/类
public boolean derivedFromType(XSTypeDefinition ancestor, short derivationMethod) {
// ancestor is null, retur false
if (ancestor == null)
return false;
// ancestor is anyType, return true
if (ancestor == SchemaGrammar.fAnyType)
return true;
// recursively get base, and compare it with ancestor
XSTypeDefinition type = this;
while (type != ancestor && // compare with ancestor
type != SchemaGrammar.fAnySimpleType && // reached anySimpleType
type != SchemaGrammar.fAnyType) { // reached anyType
type = type.getBaseType();
}
return type == ancestor;
}
示例5: getBaseType
import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的package包/类
@SuppressWarnings ("unused")
private static XSTypeDefinition getBaseType(XSTypeDefinition type)
{
if ("http://www.w3.org/2001/XMLSchema".equals(type.getNamespace()))
return type;
XSTypeDefinition base_type = type.getBaseType();
if (base_type != null)
{
return getBaseType(base_type);
}
else
return type;
}
示例6: includesBaseType
import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的package包/类
private static boolean includesBaseType(XSTypeDefinition type,
String type_name)
{
XSTypeDefinition base_type = type.getBaseType();
if (base_type != null)
{
if (base_type.getName().equals(type_name))
return true;
else
return includesBaseType(base_type, type_name);
}
else
return false;
}
示例7: isDerivedByAny
import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的package包/类
/**
* Checks if a type is derived from another by any combination of
* restriction, list ir 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 derivationMethod
* A short indication the method of derivation
* @param type
* The reference type definition
*
* @return boolean True if the type is derived by any method for the
* reference type
*/
private boolean isDerivedByAny(String ancestorNS, String ancestorName,
int derivationMethod, XSTypeDefinition type) {
XSTypeDefinition oldType = null;
boolean derivedFrom = false;
while (type != null && type != oldType) {
// If the ancestor type is reached or is the same as this type.
if ((ancestorName.equals(type.getName()))
&& ((ancestorNS == null && type.getNamespace() == null)
|| (ancestorNS != null && ancestorNS.equals(type.getNamespace())))) {
derivedFrom = true;
break;
}
// Check if this type is derived from the base by restriction or
// extension
if (isDerivedByRestriction(ancestorNS, ancestorName,
derivationMethod, type)) {
return true;
} else if (!isDerivedByExtension(ancestorNS, ancestorName,
derivationMethod, type)) {
return true;
}
oldType = type;
type = type.getBaseType();
}
return derivedFrom;
}
示例8: isDerivedByAny
import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的package包/类
/**
* Checks if a type is derived from another by any combination of restriction, list ir 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 restriciton for the reference type
*/
private boolean isDerivedByAny(String ancestorNS, String ancestorName,
XSTypeDefinition type) {
boolean derivedFrom = false;
XSTypeDefinition oldType = null;
// for each base, item or member type
while (type != null && type != oldType) {
// If the ancestor type is reached or is the same as this type.
if ((ancestorName.equals(type.getName()))
&& ((ancestorNS == null && type.getNamespace() == null)
|| (ancestorNS != null && ancestorNS.equals(type.getNamespace())))) {
derivedFrom = true;
break;
}
// check if derived by restriction or list or union
if (isDerivedByRestriction(ancestorNS, ancestorName, type)) {
return true;
} else if (isDerivedByList(ancestorNS, ancestorName, type)) {
return true;
} else if (isDerivedByUnion(ancestorNS, ancestorName, type)) {
return true;
}
oldType = type;
// get the base, item or member type depending on the variety
if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_ABSENT
|| ((XSSimpleTypeDecl) type).getVariety() == VARIETY_ATOMIC) {
type = type.getBaseType();
} else if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_UNION) {
for (int i = 0; i < ((XSSimpleTypeDecl) type).getMemberTypes().getLength(); i++) {
return isDerivedByAny(ancestorNS, ancestorName,
(XSTypeDefinition) ((XSSimpleTypeDecl) type)
.getMemberTypes().item(i));
}
} else if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_LIST) {
type = ((XSSimpleTypeDecl) type).getItemType();
}
}
return derivedFrom;
}
示例9: 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;
}
示例10: isDerivedByRestriction
import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的package包/类
/**
* 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;
}
示例11: isDerivedByExtension
import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的package包/类
/**
* Checks if a type is derived from another by extension. 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 extension for the
* reference type
*/
private boolean isDerivedByExtension(String ancestorNS,
String ancestorName, int derivationMethod, XSTypeDefinition type) {
boolean extension = false;
XSTypeDefinition oldType = null;
while (type != null && type != oldType) {
// If ancestor is anySimpleType return false.
if (ancestorNS != null
&& ancestorNS.equals(SchemaSymbols.URI_SCHEMAFORSCHEMA)
&& ancestorName.equals(SchemaSymbols.ATTVAL_ANYSIMPLETYPE)
&& SchemaSymbols.URI_SCHEMAFORSCHEMA.equals(type.getNamespace())
&& SchemaSymbols.ATTVAL_ANYTYPE.equals(type.getName())) {
break;
}
if ((ancestorName.equals(type.getName()))
&& ((ancestorNS == null && type.getNamespace() == null)
|| (ancestorNS != null && ancestorNS.equals(type.getNamespace())))) {
// returns true if atleast one derivation step was extension
return extension;
}
// 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;
}
// derivationMethod extension will always return false for a
// simpleType,
// we treat it like a restriction
if ((derivationMethod & DERIVATION_EXTENSION) != 0) {
return extension
& ((XSSimpleTypeDecl) type).isDOMDerivedFrom(
ancestorNS, ancestorName,
(derivationMethod & DERIVATION_RESTRICTION));
} else {
return extension
& ((XSSimpleTypeDecl) type).isDOMDerivedFrom(
ancestorNS, ancestorName, derivationMethod);
}
} else {
// If the base type is a complex type
// At least one derivation step upto the ancestor type should be
// extension.
if (((XSComplexTypeDecl) type).getDerivationMethod() == XSConstants.DERIVATION_EXTENSION) {
extension = extension | true;
}
}
oldType = type;
type = type.getBaseType();
}
return false;
}