org.exolab.castor.xml.schema

Class ElementDecl

public class ElementDecl extends Particle implements Referable

An XML Schema ElementDecl

Version: $Revision: 1.5 $ $Date: 2005/01/10 20:10:36 $

Author: Keith Visco

Constructor Summary
ElementDecl(Schema schema)
Creates a new default element definition
ElementDecl(Schema schema, String name)
Creates a new default element definition
Method Summary
voidaddIdentityConstraint(IdentityConstraint constraint)
Adds the given IdentityConstraint to this element definition.
BlockListgetBlock()
Returns the value of the 'block' attribute for this element
StringgetDefaultValue()
Returns the default value of this element definition.
FinalListgetFinal()
Returns the value of the 'final' attribute for this element definition.
StringgetFixedValue()
Returns the fixed value of this element definition.
FormgetForm()
Returns the Form for this element definition.
StringgetId()
Returns the 'id' for this element definition.
EnumerationgetIdentityConstraints()
Returns an Enumeration of IdentityConstraint objects contained within this element definition.
StringgetName()
Returns the name of this Element declaration.
StringgetName(boolean ignoreRef)
Returns the name of this Element declaration.
StructuregetParent()
Returns the parent of this ElementDecl, this value may be null if no parent has been set.
ElementDeclgetReference()
Returns the ElementDecl that this element definition references.
StringgetReferenceId()
Returns the Id used to Refer to this Object
StringgetReferenceName()
Returns the actual reference name of this AttributeDecl, or null if this AttributeDecl is not a reference.
SchemagetSchema()
Returns the XML Schema to which this element declaration belongs.
shortgetStructureType()
Returns the type of this Schema Structure
StringgetSubstitutionGroup()
Returns the substitutionGroup for this element declaration, or null if it's absent.
EnumerationgetSubstitutionGroupMembers()
Returns an enumeration of the elements that can be substitute to this element declaration.
XMLTypegetType()
Returns the XMLType (ComplexType or SimpleType) of this ElementDecl.
booleanhasChildren()
Returns true if this element has children (i.e if it holds attributes or elements).
booleanisAbstract()
Returns true if this element definition is abstract
booleanisNillable()
Returns whether or not instances of this element definition may appear with no content.
booleanisReference()
Returns true if this element definition simply references another element Definition
booleanremoveIdentityConstraint(IdentityConstraint constraint)
Removes the given IdentityConstraint from this element definition.
voidsetAbstract(boolean isAbstract)
Sets whether or not this element definition is abstract
voidsetBlock(BlockList block)
Sets the value of the 'block' attribute for this element
voidsetBlock(String block)
Sets the value of the 'block' attribute for this element
voidsetDefaultValue(String value)
Sets the default value for this element definition.
voidsetFinal(FinalList finalList)
Sets the value of the 'final' attribute for this element definition.
voidsetFinal(String finalValue)
Sets the value of the 'final' attribute for this element definition.
voidsetFixedValue(String value)
Sets the fixed value for this element definition.
voidsetForm(Form form)
Sets the Form for this element definition.
voidsetId(String id)
Sets the Id for this element definition.
voidsetName(String name)
Sets the name of the element that this Element definition defines.
voidsetNillable(boolean nillable)
Sets whether or not instances of this element definition may contain empty content
protected voidsetParent(Structure parent)
Sets the parent for this ElementDecl.
voidsetReference(ElementDecl reference)
Sets the reference for this element definition
voidsetReference(String reference)
Sets the reference for this element definition
voidsetSubstitutionGroup(String substitutionGroup)
Sets the substitutionGroup for this element definition.
voidsetType(XMLType type)
Sets the XMLType for this Element declaration.
voidsetTypeReference(String name)
Sets the type of this element to be a reference.
voidvalidate()
Checks the validity of this element definition.

Constructor Detail

ElementDecl

public ElementDecl(Schema schema)
Creates a new default element definition

Parameters: schema, the XML Schema to which this element declartion belongs
This element definition will not be valid until a name has been set

ElementDecl

public ElementDecl(Schema schema, String name)
Creates a new default element definition

Parameters: schema, the XML Schema to which this Element Declartion belongs name the name of the Element being declared

Method Detail

addIdentityConstraint

public void addIdentityConstraint(IdentityConstraint constraint)
Adds the given IdentityConstraint to this element definition.

Parameters: constraint the IdentityConstraint to add.

getBlock

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

Returns: the value of the block attribute.

getDefaultValue

public String getDefaultValue()
Returns the default value of this element definition.

Returns: the default value of this element definition, or null if no default was specified.

getFinal

public FinalList getFinal()
Returns the value of the 'final' attribute for this element definition.

Returns: the FinalList for this element definition.

getFixedValue

public String getFixedValue()
Returns the fixed value of this element definition.

Returns: the fixed value of this element definition, or null if no default was specified.

getForm

public Form getForm()
Returns the Form for this element definition. The Form object species whether or not names are qualified or unqualified in the scope of this element definition. If null, the Form should be obtained from the parent Schema.

Returns: the Form for this element definition, or null if not set.

getId

public String getId()
Returns the 'id' for this element definition.

Returns: the 'id' for this element definition.

getIdentityConstraints

public Enumeration getIdentityConstraints()
Returns an Enumeration of IdentityConstraint objects contained within this element definition.

Returns: an Enumeration of IdentityConstraint objects contained within this element definition.

getName

public String getName()
Returns the name of this Element declaration. The name of the referenced element is returned if the 'ref' attribute was used. The name returned will be an NCName (no namespace prefix will be included with the name).

Returns: the name of this element declaration

getName

public String getName(boolean ignoreRef)
Returns the name of this Element declaration. The name returned, if not null, will be an NCName.

Parameters: ingoreRef if false the name of the referenced element (if specified) is returned, otherwise the localname (may be null).

Returns: the name of this element declaration

getParent

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

Returns: the parent Structure of this ElementDecl

getReference

public ElementDecl getReference()
Returns the ElementDecl that this element definition references. This will return null if this element definition does not reference a different element definition.

Returns: the ElementDecl that this element definition references

getReferenceId

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

Returns: the Id used to Refer to this Object

See Also:

getReferenceName

public String getReferenceName()
Returns the actual reference name of this AttributeDecl, or null if this AttributeDecl is not a reference. The name returned, if not null, will be a QName, possibly containing the namespace prefix.

Returns: the reference name

getSchema

public Schema getSchema()
Returns the XML Schema to which this element declaration belongs.

Returns: the XML Schema to which this element declaration belongs.

getStructureType

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

Returns: the type of this Schema Structure

getSubstitutionGroup

public String getSubstitutionGroup()
Returns the substitutionGroup for this element declaration, or null if it's absent.

Returns: the substitutionGroup membership for this element declaration, or null if absent.

getSubstitutionGroupMembers

public Enumeration getSubstitutionGroupMembers()
Returns an enumeration of the elements that can be substitute to this element declaration.

Returns: an enumeration of the elements that can be substitute to this element declaration.

getType

public XMLType getType()
Returns the XMLType (ComplexType or SimpleType) of this ElementDecl.

Returns: the XMLType of this ElementDecl

hasChildren

public boolean hasChildren()
Returns true if this element has children (i.e if it holds attributes or elements).

isAbstract

public boolean isAbstract()
Returns true if this element definition is abstract

Returns: true if this element definition is abstract

isNillable

public boolean isNillable()
Returns whether or not instances of this element definition may appear with no content.

Returns: true if instances of this element definition may appear with no content, otherwise false.

isReference

public boolean isReference()
Returns true if this element definition simply references another element Definition

Returns: true if this element definition is a reference

removeIdentityConstraint

public boolean removeIdentityConstraint(IdentityConstraint constraint)
Removes the given IdentityConstraint from this element definition.

Parameters: constraint the IdentityConstraint to remove.

Returns: true if the IdentityConstraint was contained within this element defintion.

setAbstract

public void setAbstract(boolean isAbstract)
Sets whether or not this element definition is abstract

Parameters: isAbstract, a boolean when true indicates that this element definition should be abstract

setBlock

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

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

setBlock

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

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

setDefaultValue

public void setDefaultValue(String value)
Sets the default value for this element definition.

Parameters: value the default value for this element definition.

setFinal

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

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

setFinal

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

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

setFixedValue

public void setFixedValue(String value)
Sets the fixed value for this element definition.

Parameters: value the fixed value for this element definition.

setForm

public void setForm(Form form)
Sets the Form for this element definition. The Form object species whether or not names are qualified or unqualified in the scope of this element definition. If null, the Form is to be obtained from the parent Schema.

Parameters: form the Form type for this element definition.

setId

public void setId(String id)
Sets the Id for this element definition.

Parameters: id the Id for this element definition.

setName

public void setName(String name)
Sets the name of the element that this Element definition defines.

Parameters: name the name of the defined element

setNillable

public void setNillable(boolean nillable)
Sets whether or not instances of this element definition may contain empty content

Parameters: nillable the flag when true indicates that instances of this element definition may appear with empty content

setParent

protected void setParent(Structure parent)
Sets the parent for this ElementDecl.

Parameters: parent the parent Structure for this ElementDecl

setReference

public void setReference(ElementDecl reference)
Sets the reference for this element definition

Parameters: reference the Element definition that this definition references

setReference

public void setReference(String reference)
Sets the reference for this element definition

Parameters: reference the name of the element definition that this definition references

setSubstitutionGroup

public void setSubstitutionGroup(String substitutionGroup)
Sets the substitutionGroup for this element definition.

Parameters: substitutionGroup the substitutionGroup for this element definition.

setType

public void setType(XMLType type)
Sets the XMLType for this Element declaration.

Parameters: type the XMLType for this element declaration.
Note: This method is mutually exclusive with #setTypeReference, if a reference has previously been set it will be ignored.

setTypeReference

public void setTypeReference(String name)
Sets the type of this element to be a reference.

validate

public void validate()
Checks the validity of this element definition.

Throws: ValidationException when this element definition is invalid.

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