/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
*/
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* The XML representation for a complexType
* schema component is a <complexType> element information item
*
* @xerces.internal
*
* @author Elena Litani, IBM
* @author Sandy Gao, IBM
* @version $Id: XSComplexTypeDecl.java,v 1.8 2010-11-01 04:39:55 joehw Exp $
*/
// name of the complexType
// target namespace of the complexType
// base type of the complexType
// derivation method of the complexType
// final set of the complexType
// block set (prohibited substitution) of the complexType
// flags: whether is abstract; whether contains ID type;
// whether it's an anonymous tpye
// the attribute group that holds the attribute uses and attribute wildcard
// the content type of the complexType
// if the content type is simple, then the corresponding simpleType
// if the content type is element or mixed, the particle
// if there is a particle, the content model corresponding to that particle
// the content model that's sufficient for computing UPA
// list of annotations affiliated with this type
// The namespace schema information item corresponding to the target namespace
// of the complex type definition, if it is globally declared; or null otherwise.
// DOM Level 3 TypeInfo Derivation Method constants
public XSComplexTypeDecl() {
// do-nothing constructor for now.
}
short block, short contentType,
if(isAbstract)
}
}
public short getTypeCategory() {
return COMPLEX_TYPE;
}
return fName;
}
public short getFinalSet(){
return fFinal;
}
return fTargetNamespace;
}
// flags for the misc flag
public boolean containsTypeID () {
}
public void setIsAbstractType() {
}
public void setContainsTypeID() {
}
public void setIsAnonymous() {
}
// for complex type with empty or simple content,
// there is no content model validator
return null;
}
if (fCMValidator == null)
synchronized (this) {
if (fCMValidator == null) {
}
}
return fCMValidator;
}
// some utility methods:
// return the attribute group for this complex type
return fAttrGrp;
}
}
str.append("Complex type name='").append(fTargetNamespace).append(',').append(getTypeName()).append("', ");
}
}
}
// ancestor is null, retur false
return false;
// ancestor is anyType, return true
return true;
// recursively get base, and compare it with ancestor
XSTypeDefinition type = this;
}
}
// ancestor is null, retur false
if (ancestorName == null)
return false;
// ancestor is anyType, return true
if (ancestorNS != null &&
return true;
}
// recursively get base, and compare it with ancestor
XSTypeDefinition type = this;
}
}
/**
* Checks if a type is derived from another given the the name, namespace
* and derivation method. 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
* The derivation method
*
* @return boolean True if the ancestor type is derived from the reference
* type by the specifiied derivation method.
*/
int derivationMethod) {
// ancestor is null, retur false
if (ancestorName == null)
return false;
// ancestor is anyType, return true
if (ancestorNS != null
&& derivationMethod == DERIVATION_EXTENSION)) {
return true;
}
// restriction
derivationMethod, this)) {
return true;
}
}
// extension
derivationMethod, this)) {
return true;
}
}
// list or union
}
&& fBaseType instanceof XSComplexTypeDecl) {
}
}
}
// If the value of the parameter is 0 i.e. no bit (corresponding to
// restriction, list, extension or union) is set to 1 for the
// derivationMethod parameter.
}
return false;
}
/**
* 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
*/
boolean derivedFrom = false;
// If the ancestor type is reached or is the same as this type.
derivedFrom = true;
break;
}
// Check if this type is derived from the base by restriction or
// extension
derivationMethod, type)) {
return true;
derivationMethod, type)) {
return true;
}
}
return derivedFrom;
}
/**
* 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
*/
// ancestor is anySimpleType, return false
if (ancestorNS != null
return false;
}
// if the name and namespace of this type is the same as the
// ancestor return true
return true;
}
// If the base type is a complexType with simpleContent
if (type instanceof XSSimpleTypeDecl) {
}
} else {
// If the base type is a complex type
// Every derivation step till the base type should be
// restriction. If not return false
return false;
}
}
}
return false;
}
/**
* 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
*/
boolean extension = false;
// If ancestor is anySimpleType return false.
if (ancestorNS != null
break;
}
// returns true if atleast one derivation step was extension
return extension;
}
// If the base type is a complexType with simpleContent
if (type instanceof XSSimpleTypeDecl) {
}
// derivationMethod extension will always return false for a
// simpleType,
// we treat it like a restriction
return extension
} else {
return extension
}
} else {
// If the base type is a complex type
// At least one derivation step upto the ancestor type should be
// extension.
}
}
}
return false;
}
public void reset(){
fMiscFlags = 0;
// reset attribute group
fCMValidator = null;
if(fAnnotations != null) {
// help out the garbage collector
}
fAnnotations = null;
}
/**
* Get the type of the object, i.e ELEMENT_DECLARATION.
*/
public short getType() {
return XSConstants.TYPE_DEFINITION;
}
/**
* The <code>name</code> of this <code>XSObject</code> depending on the
* <code>XSObject</code> type.
*/
}
/**
* A boolean that specifies if the type definition is anonymous.
* Convenience attribute. This is a field is not part of
* XML Schema component model.
*/
public boolean getAnonymous() {
}
/**
* The namespace URI of this node, or <code>null</code> if it is
* unspecified. defines how a namespace URI is attached to schema
* components.
*/
return fTargetNamespace;
}
/**
* {base type definition} Either a simple type definition or a complex
* type definition.
*/
return fBaseType;
}
/**
* {derivation method} Either extension or restriction. The valid constant
* value for this <code>XSConstants</code> EXTENTION, RESTRICTION.
*/
public short getDerivationMethod() {
return fDerivedBy;
}
/**
* {final} For complex type definition it is a subset of {extension,
* restriction}. For simple type definition it is a subset of
* {extension, list, restriction, union}.
* @param derivation Extension, restriction, list, union constants
* (defined in <code>XSConstants</code>).
* @return True if derivation is in the final set, otherwise false.
*/
}
/**
* {final} For complex type definition it is a subset of {extension, restriction}.
*
* @return A bit flag that represents:
* {extension, restriction) or none for complexTypes;
* {extension, list, restriction, union} or none for simpleTypes;
*/
public short getFinal() {
return fFinal;
}
/**
* {abstract} A boolean. Complex types for which {abstract} is true must
* not be used as the {type definition} for the validation of element
* information items.
*/
public boolean getAbstract() {
}
/**
* {attribute uses} A set of attribute uses.
*/
return fAttrGrp.getAttributeUses();
}
/**
* {attribute wildcard} Optional. A wildcard.
*/
return fAttrGrp.getAttributeWildcard();
}
/**
* {content type} One of empty, a simple type definition (see
* <code>simpleType</code>, or mixed, element-only (see
* <code>cmParticle</code>).
*/
public short getContentType() {
return fContentType;
}
/**
* A simple type definition corresponding to simple content model,
* otherwise <code>null</code>
*/
return fXSSimpleType;
}
/**
* A particle for mixed or element-only content model, otherwise
* <code>null</code>
*/
return fParticle;
}
/**
* {prohibited substitutions} A subset of {extension, restriction}.
* @param prohibited extention or restriction constants (defined in
* <code>XSConstants</code>).
* @return True if prohibited is a prohibited substitution, otherwise
* false.
*/
}
/**
* {prohibited substitutions}
*
* @return A bit flag corresponding to prohibited substitutions
*/
public short getProhibitedSubstitutions() {
return fBlock;
}
/**
* Optional. Annotation.
*/
}
/**
* @see org.apache.xerces.xs.XSObject#getNamespaceItem()
*/
return fNamespaceItem;
}
}
/* (non-Javadoc)
* @see org.apache.xerces.xs.XSComplexTypeDefinition#getAttributeUse(java.lang.String, java.lang.String)
*/
}
return getNamespace();
}
}
} // class XSComplexTypeDecl