Package org.exolab.castor.xml.schema
Class ElementDecl
java.lang.Object
org.exolab.castor.xml.schema.Structure
org.exolab.castor.xml.schema.Annotated
org.exolab.castor.xml.schema.Particle
org.exolab.castor.xml.schema.ElementDecl
- All Implemented Interfaces:
Serializable
,Referable
An XML Schema ElementDecl
- Version:
- $Revision: 8667 $ $Date: 2006-04-25 15:08:23 -0600 (Tue, 25 Apr 2006) $
- Author:
- Keith Visco
- See Also:
-
Field Summary
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
ConstructorsConstructorDescriptionElementDecl
(Schema schema) Creates a new default element definitionElementDecl
(Schema schema, String name) Creates a new default element definition -
Method Summary
Modifier and TypeMethodDescriptionvoid
addIdentityConstraint
(IdentityConstraint constraint) Adds the given IdentityConstraint to this element definition.getBlock()
Returns the value of the 'block' attribute for this elementReturns the default value of this element definition.getFinal()
Returns the value of the 'final' attribute for this element definition.Returns the fixed value of this element definition.getForm()
Returns the Form for this element definition.getId()
Returns the 'id' for this element definition.Returns an Enumeration of IdentityConstraint objects contained within this element definition.getName()
Returns the name of this Element declaration.getName
(boolean ignoreRef) Returns the name of this Element declaration.Returns the parent of this ElementDecl, this value may be null if no parent has been set.Returns the ElementDecl that this element definition references.Returns the Id used to Refer to this ObjectReturns the actual reference name of this AttributeDecl, or null if this AttributeDecl is not a reference.Returns the XML Schema to which this element declaration belongs.short
Returns the type of this Schema StructureReturns the substitutionGroup for this element declaration, or null if it's absent; if thisElementDecl
instance is a reference to a global element definition, return its substitution groupReturns an enumeration of the elements that can be substitute to this element declaration.getType()
Returns the XMLType (ComplexType or SimpleType) of this ElementDecl.boolean
Returns true if this element has children (i.e if it holds attributes or elements).boolean
Indicates whether a type is set for this element definiion.boolean
Returns true if this element definition is abstractboolean
Returns whether or not instances of this element definition may appear with no content.boolean
Returns true if this element definition simply references another element Definitionboolean
removeIdentityConstraint
(IdentityConstraint constraint) Removes the given IdentityConstraint from this element definition.void
setAbstract
(boolean isAbstract) Sets whether or not this element definition is abstractvoid
Sets the value of the 'block' attribute for this elementvoid
Sets the value of the 'block' attribute for this elementvoid
setDefaultValue
(String value) Sets the default value for this element definition.void
Sets the value of the 'final' attribute for this element definition.void
Sets the value of the 'final' attribute for this element definition.void
setFixedValue
(String value) Sets the fixed value for this element definition.void
Sets the Form for this element definition.void
Sets the Id for this element definition.void
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 contentprotected void
Sets the parent for this ElementDecl.void
setReference
(ElementDecl reference) Sets the reference for this element definitionvoid
setReferenceName
(String referenceName) Sets the name which this element declaration refers tovoid
setSubstitutionGroup
(String substitutionGroup) Sets the substitutionGroup for this element definition.void
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, isEmptiable, isMaxOccursSet, isMinOccursSet, setMaxOccurs, setMinOccurs
Methods inherited from class org.exolab.castor.xml.schema.Annotated
addAnnotation, getAnnotations, removeAnnotation
-
Constructor Details
-
ElementDecl
Creates a new default element definition- Parameters:
schema
- the XML Schema to which this element declaration belongs
This element definition will not be valid until a name has been set
-
ElementDecl
Creates a new default element definition- Parameters:
schema
- the XML Schema to which this Element Declaration belongsname
- the name of the Element being declared
-
-
Method Details
-
addIdentityConstraint
Adds the given IdentityConstraint to this element definition.- Parameters:
constraint
- the IdentityConstraint to add.
-
getBlock
Returns the value of the 'block' attribute for this element- Returns:
- the value of the block attribute.
-
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
Returns the value of the 'final' attribute for this element definition.- Returns:
- the FinalList for this element definition.
-
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
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
Returns the 'id' for this element definition.- Returns:
- the 'id' for this element definition.
-
getIdentityConstraints
Returns an Enumeration of IdentityConstraint objects contained within this element definition.- Returns:
- an Enumeration of IdentityConstraint objects contained within this element definition.
-
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
Returns the name of this Element declaration. The name returned, if not null, will be an NCName.- Parameters:
ignoreRef
- 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
Returns the parent of this ElementDecl, this value may be null if no parent has been set.- Returns:
- the parent Structure of this ElementDecl
-
getType
Returns the XMLType (ComplexType or SimpleType) of this ElementDecl.- Returns:
- the XMLType of this 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
-
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
-
getReferenceId
Returns the Id used to Refer to this Object- Specified by:
getReferenceId
in interfaceReferable
- Returns:
- the Id used to Refer to this Object
- See Also:
-
getSchema
Returns the XML Schema to which this element declaration belongs.- Returns:
- the XML Schema to which this element declaration belongs.
-
getSubstitutionGroup
Returns the substitutionGroup for this element declaration, or null if it's absent; if thisElementDecl
instance is a reference to a global element definition, return its substitution group- Returns:
- the substitutionGroup membership for this element declaration, or null if absent.
-
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.
-
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
-
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
-
hasChildren
public boolean hasChildren()Returns true if this element has children (i.e if it holds attributes or elements).- Returns:
- true if this element has children (i.e if it holds attributes or elements).
-
removeIdentityConstraint
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.
-
setBlock
Sets the value of the 'block' attribute for this element- Parameters:
block
- the value of the block attribute for this element definition.
-
setBlock
Sets the value of the 'block' attribute for this element- Parameters:
block
- the value of the block attribute for this element definition.
-
setDefaultValue
Sets the default value for this element definition.- Parameters:
value
- the default value for this element definition.
-
setFinal
Sets the value of the 'final' attribute for this element definition.- Parameters:
finalList
- the value of the final attribute for this element definition.
-
setFinal
Sets the value of the 'final' attribute for this element definition.- Parameters:
finalValue
- the value of the final attribute for this element definition.
-
setFixedValue
Sets the fixed value for this element definition.- Parameters:
value
- the fixed value for this element definition.
-
setForm
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
Sets the Id for this element definition.- Parameters:
id
- the Id for this element definition.
-
setName
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
Sets the parent for this ElementDecl.- Parameters:
parent
- the parent Structure for this ElementDecl
-
setReference
Sets the reference for this element definition- Parameters:
reference
- the Element definition that this definition references
-
setReferenceName
Sets the name which this element declaration refers to- Parameters:
referenceName
- the name of the element definition that this definition references
-
setSubstitutionGroup
Sets the substitutionGroup for this element definition.- Parameters:
substitutionGroup
- the substitutionGroup for this element definition.
-
setType
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
Sets the type of this element to be a reference. -
getStructureType
public short getStructureType()Returns the type of this Schema Structure- Specified by:
getStructureType
in classStructure
- Returns:
- the type of this Schema Structure
-
validate
Checks the validity of this element definition.- Specified by:
validate
in classStructure
- Throws:
ValidationException
- when this element definition is invalid.
-
hasXMLType
public boolean hasXMLType()Indicates whether a type is set for this element definiion.- Returns:
- True if a type is set.
-