本文整理汇总了Java中mf.org.apache.xerces.xs.XSConstants.DERIVATION_EXTENSION属性的典型用法代码示例。如果您正苦于以下问题:Java XSConstants.DERIVATION_EXTENSION属性的具体用法?Java XSConstants.DERIVATION_EXTENSION怎么用?Java XSConstants.DERIVATION_EXTENSION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类mf.org.apache.xerces.xs.XSConstants
的用法示例。
在下文中一共展示了XSConstants.DERIVATION_EXTENSION属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAnnotationElementDecl
private XSElementDecl createAnnotationElementDecl(String localName) {
XSElementDecl eDecl = new XSElementDecl();
eDecl.fName = localName;
eDecl.fTargetNamespace = fTargetNamespace;
eDecl.setIsGlobal();
eDecl.fBlock = (XSConstants.DERIVATION_EXTENSION |
XSConstants.DERIVATION_RESTRICTION | XSConstants.DERIVATION_SUBSTITUTION);
eDecl.setConstraintType(XSConstants.VC_NONE);
return eDecl;
}
示例2: isDerivedByExtension
/**
* 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;
}