org.exolab.castor.xml.schema

Class ComplexType

public class ComplexType extends XMLType implements ContentModelGroup, Referable

The XML Schema ComplexType class

Version: $Revision: 1.6 $ $Date: 2004/10/01 13:25:21 $

Author: Keith Visco

Constructor Summary
ComplexType(Schema schema)
Creates a new Complextype, with no name
ComplexType(Schema schema, String name)
Creates a new Complextype with the given name
Method Summary
voidaddAttributeDecl(AttributeDecl attrDecl)
Adds the given AttributeDecl to this ComplexType
voidaddAttributeGroupReference(AttributeGroupReference attrGroupRef)
Adds the given AttributeGroupReference to this ComplexType
voidaddElementDecl(ElementDecl elementDecl)
Adds the given ElementDecl to this ContentModelGroup
voidaddGroup(Group group)
Adds the given Group to this ContentModelGroup
voidaddGroup(ModelGroup group)
Adds the given ModelGroup Definition to this ContentModelGroup
voidaddWildcard(Wildcard wildcard)
AttributeDeclcreateAttributeDecl(String name)
Creates an AttributeDecl with the given name.
Enumerationenumerate()
Returns an enumeration of all the Particles of this ContentModelGroup
WildcardgetAnyAttribute()
Returns the wilcard used in this complexType (can be null)
AttributeDeclgetAttributeDecl(String name)
Returns the AttributeDecl associated with the given name
EnumerationgetAttributeDecls()
Returns an Enumeration of *all* the AttributeDecl objects declared within this ComplexType.
EnumerationgetAttributeGroupReferences()
Returns an Enumeration of all the AttributeGroup that are referenced within this ComplexType.
XMLTypegetBaseType()
Returns the base type that this type inherits from.
BlockListgetBlock()
Returns the value of the 'block' attribute for this element
ContentTypegetContentType()
Returns the content type of this ComplexType.
ElementDeclgetElementDecl(String name)
Returns the element declaration with the given name, or null if no element declaration with that name exists in this ContentModelGroup.
FinalListgetFinal()
Returns the list of values for the final property for this ComplexType, or null if no final values have been set.
EnumerationgetLocalAttributeDecls()
Returns an Enumeration of *all* locally defined AttributeDecl declared within this ComplexType.
intgetMaxOccurs()
Returns the maximum number of occurances that this ContentModelGroup may appear
intgetMinOccurs()
Returns the minimum number of occurances that this ContentModelGroup must appear
StructuregetParent()
Returns the parent of this ComplexType, this value may be null if no parent has been set.
ParticlegetParticle(int index)
Returns the Particle at the specified index
intgetParticleCount()
Returns the number of particles contained within this ContentModelGroup
StringgetReferenceId()
Returns the Id used to Refer to this Object
shortgetStructureType()
Returns the type of this Schema Structure
booleanhasAny()
A helper method that returns true if this complexType contains an element.
booleanisAbstract()
Returns true if this ComplexType has been marked as Abstract.
booleanisComplexContent()
Returns true if this complexType is a 'complexContent'
booleanisRedefined()
Returns true if this complexType is a redefinition.
booleanisRestricted()
Returns true if this complexType is a restriction
booleanisSimpleContent()
Returns true if this complexType is a 'simpleContent'
booleanisTopLevel()
Returns true if this is a top level Complextype
voidremoveAttributeDecl(AttributeDecl attrDecl)
Removes the given AttributeDecl from this ComplexType
voidremoveAttributeGroupReference(AttributeGroupReference attrGroupRef)
Removes the given AttributeGroupReference from this ComplexType
booleanremoveElementDecl(ElementDecl element)
Removes the given ElementDecl from this ContentModelGroup.
booleanremoveGroup(Group group)
Removes the given Group from this ContentModelGroup.
booleanremoveGroup(ModelGroup group)
Removes the given ModelGroup Definition from this ContentModelGroup.
booleanremoveWildcard(Wildcard wildcard)
Removes the given Wildcard from this Group.
voidsetAbstract(boolean isAbstract)
Sets whether or not this ComplexType should be abstract.
voidsetAnyAttribute(Wildcard wildcard)
Sets the wildcard (anyAttribute) of the complexType
voidsetBase(String base)
Sets the base type that this type is derived from
voidsetBaseType(XMLType baseType)
Sets the base type for this ComplexType
voidsetBlock(BlockList block)
Sets the value of the 'block' attribute for this ComplexType.
voidsetBlock(String block)
Sets the value of the 'block' attribute for this ComplexType.
voidsetComplexContent(boolean complexContent)
Sets whether or not this complexType is a 'complexContent'
voidsetContentType(ContentType contentType)
Sets the content type of this complexType.
voidsetFinal(FinalList finalList)
Sets the value of the 'final' attribute for this ComplexType definition.
voidsetFinal(String finalValue)
Sets the value of the 'final' attribute for this ComplexType definition.
protected voidsetParent(Structure parent)
Sets the parent for this ComplexType
voidsetRedefined()
Sets this Group has redefined.
voidsetRestriction(boolean restricted)
Sets whether or not this complexType is a restriction
voidsetSimpleContent(boolean simpleContent)
Sets whether or not this complexType is a 'simpleContent'
voiduseResolver(Resolver resolver)
voidvalidate()
Checks the validity of this ComplexType defintion.

Constructor Detail

ComplexType

public ComplexType(Schema schema)
Creates a new Complextype, with no name

Parameters: schema the owning Schema document

ComplexType

public ComplexType(Schema schema, String name)
Creates a new Complextype with the given name

Parameters: schema the owning Schema name of the Complextype

Method Detail

addAttributeDecl

public void addAttributeDecl(AttributeDecl attrDecl)
Adds the given AttributeDecl to this ComplexType

Parameters: attrDecl the AttributeDecl to add to this ComplexType

Throws: SchemaException when an AttributeDecl already exists with the same name as the given AttributeDecl

addAttributeGroupReference

public void addAttributeGroupReference(AttributeGroupReference attrGroupRef)
Adds the given AttributeGroupReference to this ComplexType

Parameters: attrGroupRef the AttributeGroupReference to add to this ComplexType

addElementDecl

public void addElementDecl(ElementDecl elementDecl)
Adds the given ElementDecl to this ContentModelGroup

Parameters: elementDecl the ElementDecl to add

Throws: SchemaException when an ElementDecl already exists with the same name as the given ElementDecl

addGroup

public void addGroup(Group group)
Adds the given Group to this ContentModelGroup

Parameters: group the Group to add

Throws: SchemaException when a group with the same name as the specified group already exists in the current scope

addGroup

public void addGroup(ModelGroup group)
Adds the given ModelGroup Definition to this ContentModelGroup

Parameters: group the ModelGroup to add

Throws: SchemaException when a group with the same name as the specified group already exists in the current scope

addWildcard

public void addWildcard(Wildcard wildcard)

createAttributeDecl

public AttributeDecl createAttributeDecl(String name)
Creates an AttributeDecl with the given name. The attribute declaration will still need to be added to this Complextype, or another archetype in the same schema, by making a call to #addAttributeDecl

Parameters: name the name of the attribute

Returns: the new AttributeDecl

enumerate

public Enumeration enumerate()
Returns an enumeration of all the Particles of this ContentModelGroup

Returns: an enumeration of the Particles contained within this ContentModelGroup

getAnyAttribute

public Wildcard getAnyAttribute()
Returns the wilcard used in this complexType (can be null)

Returns: the wilcard used in this complexType (can be null)

getAttributeDecl

public AttributeDecl getAttributeDecl(String name)
Returns the AttributeDecl associated with the given name

Returns: the AttributeDecl associated with the given name, or null if no AttributeDecl with the given name was found.

getAttributeDecls

public Enumeration getAttributeDecls()
Returns an Enumeration of *all* the AttributeDecl objects declared within this ComplexType. The Enumeration will contain all AttributeDecl from AttributeGroup references as well. To return only locally declared attributes make a call to getLocalAttributeDecls.

Returns: an Enumeration of all the AttributeDecl objects declared within this Complextype

getAttributeGroupReferences

public Enumeration getAttributeGroupReferences()
Returns an Enumeration of all the AttributeGroup that are referenced within this ComplexType.

Returns: an Enumeration of all the AttributeGroup that are referenced within this ComplexType.

getBaseType

public XMLType getBaseType()
Returns the base type that this type inherits from.

Returns: the base type (also called super type).

getBlock

public BlockList getBlock()
Returns the value of the 'block' attribute for this element

Returns: the value of the 'block' attribute for this element

getContentType

public ContentType getContentType()
Returns the content type of this ComplexType. The Content Type holds the information about the content of the complexType. For instance, if this complexType is a simpleContent then the simpleType information will be hold in the content type.

Returns: the content type of this ComplexType

getElementDecl

public ElementDecl getElementDecl(String name)
Returns the element declaration with the given name, or null if no element declaration with that name exists in this ContentModelGroup.

Parameters: name the name of the element.

Returns: the ElementDecl with the given name, or null if no ElementDecl exists in this ContentModelGroup.

getFinal

public FinalList getFinal()
Returns the list of values for the final property for this ComplexType, or null if no final values have been set.

Returns: the FinalList for this ComplexType

getLocalAttributeDecls

public Enumeration getLocalAttributeDecls()
Returns an Enumeration of *all* locally defined AttributeDecl declared within this ComplexType. The Enumeration will not contain any AttributeDecl from AttributeGroup references.

Returns: an Enumeration of all locally declared AttributeDecl.

getMaxOccurs

public int getMaxOccurs()
Returns the maximum number of occurances that this ContentModelGroup may appear

Returns: the maximum number of occurances that this ContentModelGroup may appear. A non positive (n < 1) value indicates that the value is unspecified (ie. unbounded).

getMinOccurs

public int getMinOccurs()
Returns the minimum number of occurances that this ContentModelGroup must appear

Returns: the minimum number of occurances that this ContentModelGroup must appear A negative (n < 0) value indicates that the value is unspecified.

getParent

public Structure getParent()
Returns the parent of this ComplexType, this value may be null if no parent has been set.

Returns: the parent Structure of this ComplexType.

getParticle

public Particle getParticle(int index)
Returns the Particle at the specified index

Parameters: index the index of the particle to return

UNKNOWN: the CMParticle at the specified index

getParticleCount

public int getParticleCount()
Returns the number of particles contained within this ContentModelGroup

Returns: the number of particles

getReferenceId

public String getReferenceId()
Returns the Id used to Refer to this Object

Returns: the Id used to Refer to this Object

See Also:

getStructureType

public short getStructureType()
Returns the type of this Schema Structure

Returns: the type of this Schema Structure

hasAny

public boolean hasAny()
A helper method that returns true if this complexType contains an element.

Returns: method that returns true if this complexType contains an element.

isAbstract

public boolean isAbstract()
Returns true if this ComplexType has been marked as Abstract.

Returns: true if this ComplexType is "abstract".

isComplexContent

public boolean isComplexContent()
Returns true if this complexType is a 'complexContent'

UNKNOWN: true if this complexType is a 'complexContent'

isRedefined

public boolean isRedefined()
Returns true if this complexType is a redefinition.

Returns: true if this complexType is a redefinition.

isRestricted

public boolean isRestricted()
Returns true if this complexType is a restriction

UNKNOWN: true if this complexType is a restriction

isSimpleContent

public boolean isSimpleContent()
Returns true if this complexType is a 'simpleContent'

UNKNOWN: true if this complexType is a 'simpleContent'

isTopLevel

public boolean isTopLevel()
Returns true if this is a top level Complextype

Returns: true if this is a top level Complextype

removeAttributeDecl

public void removeAttributeDecl(AttributeDecl attrDecl)
Removes the given AttributeDecl from this ComplexType

Parameters: attrDecl the AttributeDecl to remove.

removeAttributeGroupReference

public void removeAttributeGroupReference(AttributeGroupReference attrGroupRef)
Removes the given AttributeGroupReference from this ComplexType

Parameters: attrGroupRef the AttributeGroupReference to remove.

removeElementDecl

public boolean removeElementDecl(ElementDecl element)
Removes the given ElementDecl from this ContentModelGroup.

Parameters: elementDecl the ElementDecl to remove.

Returns: true if the element has been successfully removed, false otherwise.

removeGroup

public boolean removeGroup(Group group)
Removes the given Group from this ContentModelGroup.

Parameters: group the Group to remove.

Returns: true if the group has been successfully removed, false otherwise.

removeGroup

public boolean removeGroup(ModelGroup group)
Removes the given ModelGroup Definition from this ContentModelGroup.

Parameters: group the ModelGroup Definition to remove.

Returns: true if the group has been successfully removed, false otherwise.

removeWildcard

public boolean removeWildcard(Wildcard wildcard)
Removes the given Wildcard from this Group.

Parameters: wilcard the Wildcard to remove.

Returns: true if the wildcard has been successfully removed, false otherwise.

setAbstract

public void setAbstract(boolean isAbstract)
Sets whether or not this ComplexType should be abstract.

Parameters: isAbstract a boolean that when true makes this ComplexType abstract.

setAnyAttribute

public void setAnyAttribute(Wildcard wildcard)
Sets the wildcard (anyAttribute) of the complexType

Throws: SchemaException thrown when a wildcard as already be set or when the wildCard is not an .

setBase

public void setBase(String base)
Sets the base type that this type is derived from

Parameters: base the type that this type is derived from

setBaseType

public void setBaseType(XMLType baseType)
Sets the base type for this ComplexType

Parameters: baseType the base type which this ComplexType extends or restricts

setBlock

public void setBlock(BlockList block)
Sets the value of the 'block' attribute for this ComplexType.

Parameters: block the value of the block attribute for this ComplexType definition.

setBlock

public void setBlock(String block)
Sets the value of the 'block' attribute for this ComplexType.

Parameters: block the value of the block attribute for this ComplexType definition.

setComplexContent

public void setComplexContent(boolean complexContent)
Sets whether or not this complexType is a 'complexContent'

Parameters: complexContent true if this complexType is a 'complexContent'

setContentType

public void setContentType(ContentType contentType)
Sets the content type of this complexType. The Content Type holds the information about the content of the complexType. For instance, if this complexType is a simpleContent then the simpleType information will be hold in the content type.

Parameters: contentType the ContentType for this complexType

setFinal

public void setFinal(FinalList finalList)
Sets the value of the 'final' attribute for this ComplexType definition.

Parameters: finalList the value of the final attribute for this ComplexType definition.

setFinal

public void setFinal(String finalValue)
Sets the value of the 'final' attribute for this ComplexType definition.

Parameters: finalValue the value of the final attribute for this ComplexType definition.

setParent

protected void setParent(Structure parent)
Sets the parent for this ComplexType

Parameters: parent the parent Structure for this ComplexType

setRedefined

public void setRedefined()
Sets this Group has redefined.

setRestriction

public void setRestriction(boolean restricted)
Sets whether or not this complexType is a restriction

Parameters: complexContent true if this complexType is a restriction

setSimpleContent

public void setSimpleContent(boolean simpleContent)
Sets whether or not this complexType is a 'simpleContent'

Parameters: complexContent true if this complexType is a 'simpleContent'

useResolver

public void useResolver(Resolver resolver)

validate

public void validate()
Checks the validity of this ComplexType defintion.

Throws: ValidationException when this ComplexType definition is invalid.

Intalio Inc. (C) 1999-2004. All rights reserved http://www.intalio.com