org.exolab.castor.xml.schema

Class ElementDecl

Implemented Interfaces:
Referable, java.io.Serializable

public class ElementDecl
extends Particle
implements Referable

An XML Schema ElementDecl
Version:
$Revision: 1.2 $ $Date: 2003/03/03 09:57:19 $
Author:
Keith Visco
See Also:
Serialized Form

Field Summary

Fields inherited from class org.exolab.castor.xml.schema.Particle

UNBOUNDED

Fields inherited from class org.exolab.castor.xml.schema.Structure

ANNOTATION, ANYTYPE, APPINFO, ATTRIBUTE, ATTRIBUTE_GROUP, COMPLEX_CONTENT, COMPLEX_TYPE, DOCUMENTATION, ELEMENT, FACET, GROUP, IDENTITY_FIELD, IDENTITY_SELECTOR, KEY, KEYREF, LIST, MODELGROUP, MODELGROUP_REF, REDEFINE, SCHEMA, SIMPLE_CONTENT, SIMPLE_TYPE, UNION, UNIQUE, UNKNOWN, WILDCARD

Constructor Summary

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

Method Summary

void
addIdentityConstraint(IdentityConstraint constraint)
Adds the given IdentityConstraint to this element definition.
BlockList
getBlock()
Returns the value of the 'block' attribute for this element
String
getDefaultValue()
Returns the default value of this element definition.
FinalList
getFinal()
Returns the value of the 'final' attribute for this element definition.
String
getFixedValue()
Returns the fixed value of this element definition.
Form
getForm()
Returns the Form for this element definition.
String
getId()
Returns the 'id' for this element definition.
Enumeration
getIdentityConstraints()
Returns an Enumeration of IdentityConstraint objects contained within this element definition.
String
getName()
Returns the name of this Element declaration.
String
getName(boolean ignoreRef)
Returns the name of this Element declaration.
Structure
getParent()
Returns the parent of this ElementDecl, this value may be null if no parent has been set.
ElementDecl
getReference()
Returns the ElementDecl that this element definition references.
String
getReferenceId()
Returns the Id used to Refer to this Object
String
getReferenceName()
Returns the actual reference name of this AttributeDecl, or null if this AttributeDecl is not a reference.
Schema
getSchema()
Returns the XML Schema to which this element declaration belongs.
short
getStructureType()
Returns the type of this Schema Structure
String
getSubstitutionGroup()
Returns the substitutionGroup for this element declaration, or null if it's absent.
XMLType
getType()
Returns the XMLType (ComplexType or SimpleType) of this ElementDecl.
boolean
hasChildren()
Returns true if this element has children (i.e if it holds attributes or elements).
boolean
isAbstract()
Returns true if this element definition is abstract
boolean
isNillable()
Returns whether or not instances of this element definition may appear with no content.
boolean
isReference()
Returns true if this element definition simply references another element Definition
boolean
removeIdentityConstraint(IdentityConstraint constraint)
Removes the given IdentityConstraint from this element definition.
void
setAbstract(boolean isAbstract)
Sets whether or not this element definition is abstract
void
setBlock(String block)
Sets the value of the 'block' attribute for this element
void
setBlock(BlockList block)
Sets the value of the 'block' attribute for this element
void
setDefaultValue(String value)
Sets the default value for this element definition.
void
setFinal(String finalValue)
Sets the value of the 'final' attribute for this element definition.
void
setFinal(FinalList finalList)
Sets the value of the 'final' attribute for this element definition.
void
setFixedValue(String value)
Sets the fixed value for this element definition.
void
setForm(Form form)
Sets the Form for this element definition.
void
setId(String id)
Sets the Id for this element definition.
void
setName(String name)
Sets the name of the element that this Element definition defines.
void
setNillable(boolean nillable)
Sets whether or not instances of this element definition may contain empty content
protected void
setParent(Structure parent)
Sets the parent for this ElementDecl.
void
setReference(String reference)
Sets the reference for this element definition
void
setReference(ElementDecl reference)
Sets the reference for this element definition
void
setSubstitutionGroup(String substitutionGroup)
Sets the substitutionGroup for this element definition.
void
setType(XMLType type)
Sets the XMLType for this Element declaration.
void
setTypeReference(String name)
Sets the type of this element to be a reference.
void
validate()
Checks the validity of this element definition.

Methods inherited from class org.exolab.castor.xml.schema.Particle

getMaxOccurs, getMinOccurs, setMaxOccurs, setMinOccurs

Methods inherited from class org.exolab.castor.xml.schema.Annotated

addAnnotation, getAnnotations, removeAnnotation

Methods inherited from class org.exolab.castor.xml.schema.Structure

getStructureType, isValid, validate

Constructor Details

ElementDecl

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

ElementDecl

public ElementDecl(Schema schema,
                   String name)
Creates a new default element definition
Parameters:
name - the name of the Element being declared

Method Details

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:
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
Specified by:
getReferenceId in interface Referable
Returns:
the Id used to Refer to this Object
See Also:
Referable

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
Overrides:
getStructureType in interface 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.

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:

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.

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.

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(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.

setFinal

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

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(String reference)
Sets the reference for this element definition
Parameters:
reference - the name of the element definition that this definition references

setReference

public void setReference(ElementDecl reference)
Sets the reference for this element definition
Parameters:
reference - 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()
            throws ValidationException
Checks the validity of this element definition.
Overrides:
validate in interface Structure
Throws:
ValidationException - when this element definition is invalid.

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