VdexReload 1.1.3 API

uk.ac.reload.moonunit.schema
Class ReloadSchemaElement

java.lang.Object
  extended byuk.ac.reload.moonunit.schema.ReloadSchemaNode
      extended byuk.ac.reload.moonunit.schema.ReloadSchemaElement
All Implemented Interfaces:
MoonUnitConstants

public class ReloadSchemaElement
extends ReloadSchemaNode
implements MoonUnitConstants

An Element node that represents an Element in the Schema. Essentially - this is a wrapper for an ElementDecl type


Field Summary
protected  java.util.Vector _attributes
          Any Attributes
protected  java.util.Vector _children
          Any child ReloadSchemaElement objects
protected  org.exolab.castor.xml.schema.ElementDecl _elementDecl
          The wrapped Castor ElementDecl that we will interrogate
 
Fields inherited from class uk.ac.reload.moonunit.schema.ReloadSchemaNode
_parent
 
Fields inherited from interface uk.ac.reload.moonunit.MoonUnitConstants
DEBUG
 
Constructor Summary
ReloadSchemaElement(org.exolab.castor.xml.schema.ElementDecl elementDecl)
          Constructor to wrap ElementDecl.
 
Method Summary
protected  void addAttributes()
          Add any ReloadSchemaAttribute objects
protected  void addChildElementDecl(org.exolab.castor.xml.schema.ElementDecl childElementDecl)
          Add another ElementDecl child
protected  void buildChildGroup(org.exolab.castor.xml.schema.Group group)
          Build a Group type - this can contain more Elements and Groups
protected  java.util.Vector buildChildren()
          Recurse and build up all child Elements and Attributes of ElementDecl
 java.lang.String getAtomicBaseTypeName()
          Get the Atomic Base type name of this Element.
 ReloadSchemaAttribute getAttribute(java.lang.String attName)
          Get a ReloadSchemaAttribute by its name
 ReloadSchemaAttribute getAttribute(java.lang.String attName, org.jdom.Namespace ns)
          Get a ReloadSchemaAttribute by its name and Namespace
 ReloadSchemaAttribute getAttributeAtIndex(int index)
          Return a ReloadSchemaAttribute by its index position
 ReloadSchemaAttribute[] getAttributes()
          Get an array of ReloadSchemaAttribute objects
 java.lang.String getBaseTypeName()
          Get the Base type name of this Element.
 ReloadSchemaElement getChild(java.lang.String childName)
          Get a child schema element by name
 ReloadSchemaElement getChild(java.lang.String childName, org.jdom.Namespace ns)
          Get a child schema element by name with given namespace
 ReloadSchemaElement getChildAt(int index)
          Get the child ReloadSchemaElement at index position
 int getChildCount()
          Get the child count of ReloadSchemaElement child objects.
 java.lang.String[] getChildNames()
          Return a String array of child names
 ReloadSchemaElement[] getChildren()
          Get the Children Elements of this Element.
 ReloadSchemaElement[] getChildren(org.jdom.Namespace ns)
          Get the Children Elements of this Element with a given Namespace.
 java.lang.String getDefaultValue()
          Returns the default value of this element definition if it is an ElementDecl.
 DomPath getDomPath()
          Get the path to this Element.
 java.lang.String getFacetValue(java.lang.String facetName)
          Get a facet value
 int getMaxOccurs()
          Get the maximum amount of times this element can occur - -1 means unbounded.
 int getMinOccurs()
          Get the minimum amount of times this element can occur - 0 means optional
 java.lang.String getName()
          Get the name of the ElementDecl
 org.jdom.Namespace getNamespace()
          Get the Namespace of this Schema Element
 java.lang.String getNamespacePrefix()
          Get the Prefix of this Element, or "" if no prefix
 java.lang.String getTypeName()
          Get the type name of this Element.
 ReloadVocabularyList getVocabularyList()
          Get the inbuilt vocabulary list for this Element.
protected  org.exolab.castor.xml.schema.XMLType getXMLType()
          Get the xml type of the ElementDecl - this is either ComplexType or SimpleType.
 boolean hasAncestor(ReloadSchemaElement schemaElement)
          Determine if a schemaElement has an ancestor of the same name
 boolean hasAttribute(java.lang.String attName)
          Return whether this Element has an Attribute by Name
 boolean hasAttributes()
          Return whether this Element has Attributes
 boolean hasChild(java.lang.String childName)
          Return whether this ReloadSchemaElement has a child Element by name.
 boolean hasChildren()
          Return whether this Element has Child Elements.
 int indexofAttribute(ReloadSchemaAttribute att)
          Return the index of an Attribute
 int indexofAttribute(java.lang.String attName)
          Return the index of an Attribute by name
 int indexofChild(ReloadSchemaElement child)
          Get the index of the child element
 int indexofChild(java.lang.String childName)
          Return the index of a child by name
 boolean isComplexType()
          Return whether this Element is made up of other Elements.
 boolean isRoot()
          Return whether we are the Root Element, i.e our parent is null
 boolean isStringType()
          Determine whether this element's base type name is a String type
 boolean isValue()
           
 ReloadSchemaElement setReloadSchema(ReloadSchema reloadSchema)
          Set the parent owning ReloadSchema
 java.lang.String toString()
          A String representation of this Element.
 
Methods inherited from class uk.ac.reload.moonunit.schema.ReloadSchemaNode
getParent, getReloadSchema, isExternalNamespace, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_elementDecl

protected org.exolab.castor.xml.schema.ElementDecl _elementDecl
The wrapped Castor ElementDecl that we will interrogate


_children

protected java.util.Vector _children
Any child ReloadSchemaElement objects


_attributes

protected java.util.Vector _attributes
Any Attributes

Constructor Detail

ReloadSchemaElement

public ReloadSchemaElement(org.exolab.castor.xml.schema.ElementDecl elementDecl)
Constructor to wrap ElementDecl.

Parameters:
elementDecl - The wrapped Castor ElementDecl
Method Detail

addAttributes

protected void addAttributes()
Add any ReloadSchemaAttribute objects


setReloadSchema

public ReloadSchemaElement setReloadSchema(ReloadSchema reloadSchema)
Set the parent owning ReloadSchema

Parameters:
reloadSchema - The parent owning ReloadSchema
Returns:
This Element

getName

public java.lang.String getName()
Get the name of the ElementDecl

Specified by:
getName in class ReloadSchemaNode
Returns:
The Element name

getNamespacePrefix

public java.lang.String getNamespacePrefix()
Get the Prefix of this Element, or "" if no prefix

Specified by:
getNamespacePrefix in class ReloadSchemaNode
Returns:
the Prefix of this Element, or "" if no prefix

getNamespace

public org.jdom.Namespace getNamespace()
Get the Namespace of this Schema Element

Specified by:
getNamespace in class ReloadSchemaNode
Returns:
the Namespace of this Schema Element

isRoot

public boolean isRoot()
Return whether we are the Root Element, i.e our parent is null

Returns:
true if we are the root element, false otherwise

getDomPath

public DomPath getDomPath()
Get the path to this Element. This will be the full path of all parent elements plus this Element's name. For example: manifest/resources/resource This DomPath is allocated dynamically, otherwise it doesn't work!

Specified by:
getDomPath in class ReloadSchemaNode
Returns:
The path for this Element

getVocabularyList

public ReloadVocabularyList getVocabularyList()
Get the inbuilt vocabulary list for this Element. If it's a Simple type of type BOOLEAN we can return "true, false" as the list, otherwise we will look in the Vocab Helper file. This method should only be called from a SchemaController.

Returns:
vocabulary list for this Element or null if there isn't one

getTypeName

public java.lang.String getTypeName()
Get the type name of this Element.

Specified by:
getTypeName in class ReloadSchemaNode
Returns:
The type name of this Element

getBaseTypeName

public java.lang.String getBaseTypeName()
Get the Base type name of this Element.

Specified by:
getBaseTypeName in class ReloadSchemaNode
Returns:
The base type name of this Element or the type name if there is none

getAtomicBaseTypeName

public java.lang.String getAtomicBaseTypeName()
Get the Atomic Base type name of this Element.

Returns:
The base type name of this Element or the type name if there is none

isValue

public boolean isValue()
Returns:
whether this can hold an actual text/number value rather than just being a container for sub-elements

isStringType

public boolean isStringType()
Determine whether this element's base type name is a String type

Returns:
true if this element's base type name is a String type, false otherwise

getMinOccurs

public int getMinOccurs()
Get the minimum amount of times this element can occur - 0 means optional

Returns:
the minimum amount of times this element can occur - 0 means optional

getMaxOccurs

public int getMaxOccurs()
Get the maximum amount of times this element can occur - -1 means unbounded.

Returns:
the maximum amount of times this element can occur - -1 means unbounded

getDefaultValue

public java.lang.String getDefaultValue()
Returns the default value of this element definition if it is an ElementDecl. This method should only be called from a SchemaController - look into the vocabulary list first, if that is null, look here.

Specified by:
getDefaultValue in class ReloadSchemaNode
Returns:
the default value of this element definition or null if no default was specified

getXMLType

protected org.exolab.castor.xml.schema.XMLType getXMLType()
Get the xml type of the ElementDecl - this is either ComplexType or SimpleType. This only applies to ElementDecl.

Returns:
the xml type of the ElementDecl or null if this Particle is not an ElementDecl

isComplexType

public boolean isComplexType()
Return whether this Element is made up of other Elements.

Returns:
true if this Element is a Complex Type, or false if not

getFacetValue

public java.lang.String getFacetValue(java.lang.String facetName)
Get a facet value

Specified by:
getFacetValue in class ReloadSchemaNode
Parameters:
facetName - the facet name
Returns:
a Facet Value or null

getAttributes

public ReloadSchemaAttribute[] getAttributes()
Get an array of ReloadSchemaAttribute objects

Returns:
an array of ReloadSchemaAttribute objects or null if there aren't any

getAttribute

public ReloadSchemaAttribute getAttribute(java.lang.String attName)
Get a ReloadSchemaAttribute by its name

Parameters:
attName - the attribute name
Returns:
a ReloadSchemaAttribute by its name

getAttribute

public ReloadSchemaAttribute getAttribute(java.lang.String attName,
                                          org.jdom.Namespace ns)
Get a ReloadSchemaAttribute by its name and Namespace

Parameters:
attName - the attribute name
ns - the attribute namespace
Returns:
a ReloadSchemaAttribute by its name and Namespace

getAttributeAtIndex

public ReloadSchemaAttribute getAttributeAtIndex(int index)
Return a ReloadSchemaAttribute by its index position

Parameters:
index - the index position of the Attribute
Returns:
the ReloadSchemaAttribute or null if there isn't one

hasAttributes

public boolean hasAttributes()
Return whether this Element has Attributes

Returns:
true if this element has attributes, false otherwise

hasAttribute

public boolean hasAttribute(java.lang.String attName)
Return whether this Element has an Attribute by Name

Parameters:
attName - the attribute name
Returns:
true if this element has the attribute, false otherwise

indexofAttribute

public int indexofAttribute(ReloadSchemaAttribute att)
Return the index of an Attribute

Parameters:
att - the ReloadSchemaAttribute concerned
Returns:
the index of the Attribute or -1 if not found

indexofAttribute

public int indexofAttribute(java.lang.String attName)
Return the index of an Attribute by name

Parameters:
attName - the attribute name
Returns:
the index of the Attribute or -1 if not found

toString

public java.lang.String toString()
A String representation of this Element.

Returns:
the name of the Element

getChildren

public ReloadSchemaElement[] getChildren()
Get the Children Elements of this Element.

Returns:
an array of ReloadSchemaElement child objects. It will never be null

getChildren

public ReloadSchemaElement[] getChildren(org.jdom.Namespace ns)
Get the Children Elements of this Element with a given Namespace.

Parameters:
ns - the given namespace
Returns:
an array of ReloadSchemaElement child objects. It will never be null

getChildCount

public int getChildCount()
Get the child count of ReloadSchemaElement child objects.

Returns:
the Child count

hasChildren

public boolean hasChildren()
Return whether this Element has Child Elements.

Returns:
true if this Element has Children, or false if not

hasChild

public boolean hasChild(java.lang.String childName)
Return whether this ReloadSchemaElement has a child Element by name.

Parameters:
childName - the name of the child element
Returns:
true if it has the child, false otherwise

getChild

public ReloadSchemaElement getChild(java.lang.String childName)
Get a child schema element by name

Parameters:
childName - the name of the child element
Returns:
a child ReloadSchemaElement by name or null

getChild

public ReloadSchemaElement getChild(java.lang.String childName,
                                    org.jdom.Namespace ns)
Get a child schema element by name with given namespace

Parameters:
childName - the name of the child element
ns - the namespace of the child element
Returns:
a child ReloadSchemaElement by name or null

getChildAt

public ReloadSchemaElement getChildAt(int index)
Get the child ReloadSchemaElement at index position

Parameters:
index - the index position of the child element
Returns:
the child ReloadSchemaElement at index position or null if no children

indexofChild

public int indexofChild(ReloadSchemaElement child)
Get the index of the child element

Returns:
the index of the child or -1 if not found

indexofChild

public int indexofChild(java.lang.String childName)
Return the index of a child by name

Parameters:
childName - the name of the child element
Returns:
the index of the child or -1 if not found

getChildNames

public java.lang.String[] getChildNames()
Return a String array of child names

Returns:
a String array of child names

buildChildren

protected java.util.Vector buildChildren()
Recurse and build up all child Elements and Attributes of ElementDecl

Returns:
a Vector of all child elements and attributes of the ElementDecl

buildChildGroup

protected void buildChildGroup(org.exolab.castor.xml.schema.Group group)
Build a Group type - this can contain more Elements and Groups

Parameters:
group -

addChildElementDecl

protected void addChildElementDecl(org.exolab.castor.xml.schema.ElementDecl childElementDecl)
Add another ElementDecl child

Parameters:
childElementDecl - the child ElementDecl to add

hasAncestor

public boolean hasAncestor(ReloadSchemaElement schemaElement)
Determine if a schemaElement has an ancestor of the same name

Returns:
true if a schemaElement has an ancestor of the same name, false otherwise

VdexReload 1.1.3 API