Class ElementDecl

  • All Implemented Interfaces:
    java.io.Serializable, Referable

    public class ElementDecl
    extends Particle
    implements 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:
    Serialized Form
    • Constructor Detail

      • ElementDecl

        public ElementDecl​(Schema schema)
        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

        public ElementDecl​(Schema schema,
                           java.lang.String name)
        Creates a new default element definition
        Parameters:
        schema - the XML Schema to which this Element Declaration 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 java.lang.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 java.lang.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 java.lang.String getId()
        Returns the 'id' for this element definition.
        Returns:
        the 'id' for this element definition.
      • getIdentityConstraints

        public java.util.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 java.lang.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 java.lang.String getName​(boolean ignoreRef)
        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

        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
      • getType

        public XMLType getType()
        Returns the XMLType (ComplexType or SimpleType) of this ElementDecl.
        Returns:
        the XMLType 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
      • getReferenceName

        public java.lang.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
      • getReferenceId

        public java.lang.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
      • getSchema

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

        public java.lang.String getSubstitutionGroup()
        Returns the substitutionGroup for this element declaration, or null if it's absent; if this ElementDecl 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

        public java.util.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.
      • 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

        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.
      • 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​(java.lang.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​(java.lang.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:
        finalList - the value of the final attribute for this element definition.
      • setFinal

        public void setFinal​(java.lang.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​(java.lang.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​(java.lang.String id)
        Sets the Id for this element definition.
        Parameters:
        id - the Id for this element definition.
      • setName

        public void setName​(java.lang.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
      • setReferenceName

        public void setReferenceName​(java.lang.String referenceName)
        Sets the name which this element declaration refers to
        Parameters:
        referenceName - the name of the element definition that this definition references
      • setSubstitutionGroup

        public void setSubstitutionGroup​(java.lang.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​(java.lang.String name)
        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 class Structure
        Returns:
        the type of this Schema Structure
      • hasXMLType

        public boolean hasXMLType()
        Indicates whether a type is set for this element definiion.
        Returns:
        True if a type is set.