Methods Summary |
---|
void | appendTypeInfo(java.lang.StringBuffer str)
String contentType[] = {"EMPTY", "SIMPLE", "ELEMENT", "MIXED"};
String derivedBy[] = {"EMPTY", "EXTENSION", "RESTRICTION"};
str.append("Complex type name='" + fTargetNamespace + "," + getTypeName() + "', ");
if (fBaseType != null)
str.append(" base type name='" + fBaseType.getName() + "', ");
str.append(" content type='" + contentType[fContentType] + "', ");
str.append(" isAbstract='" + getAbstract() + "', ");
str.append(" hasTypeId='" + containsTypeID() + "', ");
str.append(" final='" + fFinal + "', ");
str.append(" block='" + fBlock + "', ");
if (fParticle != null)
str.append(" particle='" + fParticle.toString() + "', ");
str.append(" derivedBy='" + derivedBy[fDerivedBy] + "'. ");
|
public boolean | containsTypeID()
// methods to get/set misc flag
return((fMiscFlags & CT_HAS_TYPE_ID) != 0);
|
public boolean | derivedFrom(java.lang.String ancestorNS, java.lang.String ancestorName, short derivationMethod)
// ancestor is null, retur false
if (ancestorName == null)
return false;
// ancestor is anyType, return true
if (ancestorNS != null &&
ancestorNS.equals(SchemaSymbols.URI_SCHEMAFORSCHEMA) &&
ancestorName.equals(SchemaSymbols.ATTVAL_ANYTYPE)) {
return true;
}
// recursively get base, and compare it with ancestor
XSTypeDefinition type = this;
while (!(ancestorName.equals(type.getName()) &&
((ancestorNS == null && type.getNamespace() == null) ||
(ancestorNS != null && ancestorNS.equals(type.getNamespace())))) && // compare with ancestor
type != SchemaGrammar.fAnySimpleType && // reached anySimpleType
type != SchemaGrammar.fAnyType) { // reached anyType
if( derivationMethod!=0 ) {
if( type instanceof XSComplexTypeDefinition ) {
switch( ((XSComplexTypeDefinition)type).getDerivationMethod() ) {
case XSConstants.DERIVATION_EXTENSION:
if( (derivationMethod&TypeInfo.DERIVATION_EXTENSION) == 0 )
return false;
break;
case XSConstants.DERIVATION_RESTRICTION:
if( (derivationMethod&TypeInfo.DERIVATION_RESTRICTION) == 0 )
return false;
break;
}
} else
if( type instanceof XSSimpleTypeDefinition ) {
// broken (but then the spec is broken, so what do you expect!) FIXME.
switch( ((XSSimpleTypeDefinition)type).getVariety()) {
case XSSimpleTypeDefinition.VARIETY_ATOMIC:
if( (derivationMethod&TypeInfo.DERIVATION_RESTRICTION) == 0 )
return false;
break;
case XSSimpleTypeDefinition.VARIETY_LIST:
if( (derivationMethod&TypeInfo.DERIVATION_LIST) == 0 )
return false;
break;
case XSSimpleTypeDefinition.VARIETY_UNION:
if( (derivationMethod&TypeInfo.DERIVATION_UNION) == 0 )
return false;
break;
}
}
}
type = (XSTypeDefinition)type.getBaseType();
}
return type != SchemaGrammar.fAnySimpleType &&
type != SchemaGrammar.fAnyType;
|
public boolean | derivedFromType(com.sun.org.apache.xerces.internal.xs.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;
|
public boolean | getAbstract(){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.
return((fMiscFlags & CT_IS_ABSTRACT) != 0);
|
public com.sun.org.apache.xerces.internal.xs.XSObjectList | getAnnotations()Optional. Annotation.
return fAnnotations;
|
public boolean | getAnonymous()A boolean that specifies if the type definition is anonymous.
Convenience attribute. This is a field is not part of
XML Schema component model.
return((fMiscFlags & CT_IS_ANONYMOUS) != 0);
|
public com.sun.org.apache.xerces.internal.impl.xs.XSAttributeGroupDecl | getAttrGrp()
return fAttrGrp;
|
public com.sun.org.apache.xerces.internal.xs.XSAttributeUse | getAttributeUse(java.lang.String namespace, java.lang.String name)
return fAttrGrp.getAttributeUse(namespace, name);
|
public com.sun.org.apache.xerces.internal.xs.XSObjectList | getAttributeUses(){attribute uses} A set of attribute uses.
return fAttrGrp.getAttributeUses();
|
public com.sun.org.apache.xerces.internal.xs.XSWildcard | getAttributeWildcard(){attribute wildcard} Optional. A wildcard.
return fAttrGrp.getAttributeWildcard();
|
public com.sun.org.apache.xerces.internal.xs.XSTypeDefinition | getBaseType(){base type definition} Either a simple type definition or a complex
type definition.
return fBaseType;
|
public synchronized com.sun.org.apache.xerces.internal.impl.xs.models.XSCMValidator | getContentModel(com.sun.org.apache.xerces.internal.impl.xs.models.CMBuilder cmBuilder)
if (fCMValidator == null)
fCMValidator = cmBuilder.getContentModel(this);
return fCMValidator;
|
public short | getContentType(){content type} One of empty, a simple type definition (see
simpleType , or mixed, element-only (see
cmParticle ).
return fContentType;
|
public short | getDerivationMethod(){derivation method} Either extension or restriction. The valid constant
value for this XSConstants EXTENTION, RESTRICTION.
return fDerivedBy;
|
public short | getFinal(){final} For complex type definition it is a subset of {extension, restriction}.
return fFinal;
|
public short | getFinalSet()
return fFinal;
|
public java.lang.String | getName()The name of this XSObject depending on the
XSObject type.
return getAnonymous() ? null : fName;
|
public java.lang.String | getNamespace()The namespace URI of this node, or null if it is
unspecified. defines how a namespace URI is attached to schema
components.
return fTargetNamespace;
|
public com.sun.org.apache.xerces.internal.xs.XSNamespaceItem | getNamespaceItem()
// REVISIT: implement
return null;
|
public com.sun.org.apache.xerces.internal.xs.XSParticle | getParticle()A particle for mixed or element-only content model, otherwise
null
return fParticle;
|
public short | getProhibitedSubstitutions(){prohibited substitutions}
return fBlock;
|
public com.sun.org.apache.xerces.internal.xs.XSSimpleTypeDefinition | getSimpleType()A simple type definition corresponding to simple content model,
otherwise null
return fXSSimpleType;
|
public java.lang.String | getTargetNamespace()
return fTargetNamespace;
|
public short | getType()Get the type of the object, i.e ELEMENT_DECLARATION.
return XSConstants.TYPE_DEFINITION;
|
public short | getTypeCategory()
return COMPLEX_TYPE;
|
public java.lang.String | getTypeName()
return fName;
|
public java.lang.String | getTypeNamespace()
return getNamespace();
|
public boolean | isDerivedFrom(java.lang.String typeNamespace, java.lang.String typeName, int derivationMethod)
return derivedFrom(typeNamespace,typeName,(short)derivationMethod);
|
public boolean | isFinal(short derivation){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}.
return (fFinal & derivation) != 0;
|
public boolean | isProhibitedSubstitution(short prohibited){prohibited substitutions} A subset of {extension, restriction}.
return (fBlock & prohibited) != 0;
|
public void | reset()
fName = null;
fTargetNamespace = null;
fBaseType = null;
fDerivedBy = XSConstants.DERIVATION_RESTRICTION;
fFinal = XSConstants.DERIVATION_NONE;
fBlock = XSConstants.DERIVATION_NONE;
fMiscFlags = 0;
// reset attribute group
fAttrGrp.reset();
fContentType = CONTENTTYPE_EMPTY;
fXSSimpleType = null;
fParticle = null;
fCMValidator = null;
if(fAnnotations != null) {
// help out the garbage collector
fAnnotations.clear();
}
fAnnotations = null;
|
public void | setContainsTypeID()
fMiscFlags |= CT_HAS_TYPE_ID;
|
public void | setIsAbstractType()
fMiscFlags |= CT_IS_ABSTRACT;
|
public void | setIsAnonymous()
fMiscFlags |= CT_IS_ANONYMOUS;
|
public void | setName(java.lang.String name)
fName = name;
|
public void | setValues(java.lang.String name, java.lang.String targetNamespace, com.sun.org.apache.xerces.internal.xs.XSTypeDefinition baseType, short derivedBy, short schemaFinal, short block, short contentType, boolean isAbstract, com.sun.org.apache.xerces.internal.impl.xs.XSAttributeGroupDecl attrGrp, com.sun.org.apache.xerces.internal.impl.dv.XSSimpleType simpleType, com.sun.org.apache.xerces.internal.impl.xs.XSParticleDecl particle, com.sun.org.apache.xerces.internal.impl.xs.util.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;
|
public java.lang.String | toString()
StringBuffer str = new StringBuffer();
appendTypeInfo(str);
return str.toString();
|