本文整理汇总了Java中org.apache.xerces.xs.XSTypeDefinition.getNamespace方法的典型用法代码示例。如果您正苦于以下问题:Java XSTypeDefinition.getNamespace方法的具体用法?Java XSTypeDefinition.getNamespace怎么用?Java XSTypeDefinition.getNamespace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xerces.xs.XSTypeDefinition
的用法示例。
在下文中一共展示了XSTypeDefinition.getNamespace方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: processEnumType
import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的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
示例4: getBaseType
import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的package包/类
private int getBaseType(XSTypeDefinition std) {
if (std == null) {
return XQItemType.XQBASETYPE_ANYSIMPLETYPE;
}
if (xs_ns.equals(std.getNamespace())) {
QName qn = new QName(std.getNamespace(), std.getName());
int type = getBaseTypeForTypeName(qn);
logger.trace("getBaseType; returning {} for type {}", type, std.getName());
return type;
}
return getBaseType(std.getBaseType());
}
示例5: addGlobalTypeDecl
import org.apache.xerces.xs.XSTypeDefinition; //导入方法依赖的package包/类
void addGlobalTypeDecl(XSTypeDefinition decl) {
final String namespace = decl.getNamespace();
final String declKey = (namespace == null || namespace.length() == 0)
? "," + decl.getName() : namespace + "," + decl.getName();
if (fGlobalTypeDecls.get(declKey) == null) {
fGlobalTypeDecls.put(declKey, decl);
}
}
示例6: 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;
}
示例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 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;
}
示例8: 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;
}
示例9: 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;
}