stuart.xmlApp.dtd
Class DTDElementOnlyElement

java.lang.Object
  |
  +--stuart.xmlApp.dtd.DTDContent
        |
        +--stuart.xmlApp.dtd.DTDElement
              |
              +--stuart.xmlApp.dtd.DTDElementOnlyElement
Direct Known Subclasses:
DTDMixedContentElement

public class DTDElementOnlyElement
extends DTDElement

An Element-only DTD Element.

E.g. <!ELEMENT customer (billingAddress, phoneNumber)>

An Element-only element must have at least one child to be considered valid.


Field Summary
static java.lang.String NO_CHILDREN_ERROR
           
 
Fields inherited from class stuart.xmlApp.dtd.DTDElement
CONTENT_ANY, CONTENT_ELEMENT_ONLY, CONTENT_EMPTY, CONTENT_MIXED, CONTENT_PCDATA, DUP_ATT_NAME, INT_CONTENT_ANY, INT_CONTENT_PCDATA
 
Fields inherited from class stuart.xmlApp.dtd.DTDContent
ELEMENT, ENTITY, NOTATION
 
Constructor Summary
  DTDElementOnlyElement(java.lang.String n, boolean o)
           
protected DTDElementOnlyElement(java.lang.String n, java.lang.String c, boolean o)
          A protected constructor built for the subclass elements, specicially the mixed content model element.
 
Method Summary
 void addChildElement(DTDElement newElement, char m, boolean v)
          Add a child element to this element.
 void addDTDChildElement(DTDChildElement newChild)
          Add a DTDChildElement to this element
 DTDChildElement getChildAsChildElementAt(int index)
           
 int getChildCount()
          Returns the count of child elements
 DTDElement getChildElementAt(int index)
           
 java.util.ArrayList getChildElements()
          Returns the ArrayList of child elements
 int getChildIndexValue(DTDElement element)
          Returns the index value for the specified element
 boolean getOrdered()
          Indicates whether child elements are ordered or alternate.
 int getSequence()
           
 java.lang.String getTag()
          Returns to DTD Tag for this element.
 int getVisibleChildCount()
           
 boolean hasChildren()
          Indicates whether the element has children assigned to it.
 void removeChildElementAt(int index)
          Remove the DTDChildElement at the specified index
 void replaceChildAtIndex(DTDContent newContent, char m, int index, boolean v)
          Replace the child at the specified index with the provided element/multiplicty type child.
 void setChildMultiplicityAtIndex(int index, char m)
          Change a multiplicity for an existing child.
 void setOrdered(boolean v)
           
 java.lang.String toString()
           
 
Methods inherited from class stuart.xmlApp.dtd.DTDElement
addAttribute, changeSimpleContentModel, getAttributeAt, getAttributeCount, getAttributeTag, getContentModel, getName, getNextSequenceOrder, getTagSet, hasAttributes, main, removeAttributeAt, setName
 
Methods inherited from class stuart.xmlApp.dtd.DTDContent
setContentType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_CHILDREN_ERROR

public static final java.lang.String NO_CHILDREN_ERROR
See Also:
Constant Field Values
Constructor Detail

DTDElementOnlyElement

public DTDElementOnlyElement(java.lang.String n,
                             boolean o)

DTDElementOnlyElement

protected DTDElementOnlyElement(java.lang.String n,
                                java.lang.String c,
                                boolean o)
A protected constructor built for the subclass elements, specicially the mixed content model element. param n The name of the new element. param c Indicates the element type. Should be of type DTDElement.CONTENT_MIXED.

Method Detail

addChildElement

public void addChildElement(DTDElement newElement,
                            char m,
                            boolean v)
Add a child element to this element.

Parameters:
newElement - The element which will be a child of this element.
m - Indicates Multiplicity. Use DTDChildElement.ZERO_OR_MORE, DTDChildElement.ONE_OR_MORE, DTDChildElement.ZERO_OR_ONE or DTDChildElement.ONE
v - Indicates whether the child is visible as an attribute of the parent

setChildMultiplicityAtIndex

public void setChildMultiplicityAtIndex(int index,
                                        char m)
Change a multiplicity for an existing child.

Parameters:
index - The index for the child to be changed.
m - Indicates the new multiplicity. Use DTDChildElement.ZERO_OR_MORE, DTDChildElement.ONE_OR_MORE, DTDChildElement.ZERO_OR_ONE or DTDChildElement.ONE

addDTDChildElement

public void addDTDChildElement(DTDChildElement newChild)
Add a DTDChildElement to this element

Parameters:
newChild - A DTDChildElement to add

toString

public java.lang.String toString()
Overrides:
toString in class DTDElement

getTag

public java.lang.String getTag()
                        throws java.lang.Error
Returns to DTD Tag for this element. Allows for mixed content elements.

Overrides:
getTag in class DTDElement
java.lang.Error

getOrdered

public boolean getOrdered()
Indicates whether child elements are ordered or alternate.

True indicates ordered child elements, e.g. <!ELEMENT customer (billingAddress,phoneNumber)>

False indicates child elements are alternates, e.g. <!ELEMENT customer (billingAddress|phoneNumber)>


setOrdered

public void setOrdered(boolean v)

hasChildren

public boolean hasChildren()
Indicates whether the element has children assigned to it.

A DTDElementOnlyElement without children is assumed to be invalid.


getChildCount

public int getChildCount()
Returns the count of child elements


getVisibleChildCount

public int getVisibleChildCount()

getChildIndexValue

public int getChildIndexValue(DTDElement element)
Returns the index value for the specified element

Parameters:
element - A DTDElement to look for.

getChildElementAt

public DTDElement getChildElementAt(int index)

getChildAsChildElementAt

public DTDChildElement getChildAsChildElementAt(int index)

getChildElements

public java.util.ArrayList getChildElements()
Returns the ArrayList of child elements


getSequence

public int getSequence()

replaceChildAtIndex

public void replaceChildAtIndex(DTDContent newContent,
                                char m,
                                int index,
                                boolean v)
Replace the child at the specified index with the provided element/multiplicty type child.

Parameters:
newContent - A DTDContent object to replace the existing content at index
m - Indicates Multiplicity. Use DTDChildElement.ZERO_OR_MORE, DTDChildElement.ONE_OR_MORE, DTDChildElement.ZERO_OR_ONE or DTDChildElement.ONE
index - The index value of the DTDContent to be replaced.
v - Indicates whether the child is visible as an attribute of the parent

removeChildElementAt

public void removeChildElementAt(int index)
Remove the DTDChildElement at the specified index