stuart.xmlApp.dtd
Class DTDElement

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

public class DTDElement
extends DTDContent


Field Summary
static java.lang.String CONTENT_ANY
           
static java.lang.String CONTENT_ELEMENT_ONLY
           
static java.lang.String CONTENT_EMPTY
           
static java.lang.String CONTENT_MIXED
           
static java.lang.String CONTENT_PCDATA
           
static java.lang.String DUP_ATT_NAME
           
static int INT_CONTENT_ANY
           
static int INT_CONTENT_PCDATA
           
 
Fields inherited from class stuart.xmlApp.dtd.DTDContent
ELEMENT, ENTITY, NOTATION
 
Constructor Summary
  DTDElement(java.lang.String n)
          Create a new empty DTDElement.
  DTDElement(java.lang.String n, int otherCM)
          Create either an Element that accepts ANY content, or an Element that only accepts PCDATA content.
protected DTDElement(java.lang.String n, java.lang.String cm)
          Create a new DTDElement.
 
Method Summary
 void addAttribute(Attribute a)
          Add a new Attribute object to the Element
 void changeSimpleContentModel(java.lang.String newCM)
          Change the simple content model for a specified element.
 Attribute getAttributeAt(int index)
          Returns the attribute at index
 int getAttributeCount()
          Returns the number of existing attributes.
 java.lang.String getAttributeTag()
          Returns the attribute tag for the element.
 java.lang.String getContentModel()
          Get the Content Model for the Element
 java.lang.String getName()
          Returns the name of the element.
 int getNextSequenceOrder()
           
 java.lang.String getTag()
          Returns to DTD Tag for this element.
 java.lang.String getTagSet()
          Returns the DTD Tag and, if attributes exist, the attribute tag for this element.
 boolean hasAttributes()
          Indicates whether the Element has any attributes.
static void main(java.lang.String[] args)
          Debugging method.
 void removeAttributeAt(int index)
          Removes the attribute at the given index param index The index value of the attribute to be removed
 void setName(java.lang.String n)
           
 java.lang.String toString()
           
 
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

CONTENT_EMPTY

public static final java.lang.String CONTENT_EMPTY
See Also:
Constant Field Values

CONTENT_PCDATA

public static final java.lang.String CONTENT_PCDATA
See Also:
Constant Field Values

CONTENT_ELEMENT_ONLY

public static final java.lang.String CONTENT_ELEMENT_ONLY
See Also:
Constant Field Values

CONTENT_ANY

public static final java.lang.String CONTENT_ANY
See Also:
Constant Field Values

CONTENT_MIXED

public static final java.lang.String CONTENT_MIXED
See Also:
Constant Field Values

INT_CONTENT_PCDATA

public static final int INT_CONTENT_PCDATA
See Also:
Constant Field Values

INT_CONTENT_ANY

public static final int INT_CONTENT_ANY
See Also:
Constant Field Values

DUP_ATT_NAME

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

DTDElement

public DTDElement(java.lang.String n)
Create a new empty DTDElement.

Eg. <!ELEMENT customer EMPTY>.

Parameters:
n - Name of the Element

DTDElement

public DTDElement(java.lang.String n,
                  int otherCM)
           throws java.lang.IllegalArgumentException
Create either an Element that accepts ANY content, or an Element that only accepts PCDATA content. Use the static INT variables to set which type (INT_CONTENT_PCDATA, INT_CONTENT_ANY).

Parameters:
n - The name of the Element
otherCM - INT_CONTENT_PCDATA or INT_CONTENT_ANY

DTDElement

protected DTDElement(java.lang.String n,
                     java.lang.String cm)
              throws java.lang.IllegalArgumentException
Create a new DTDElement. Should only be used by subclassed elements.

Parameters:
n - Name of the Element
cm - Content Model for the Element. Use DTDElement static variables to set.
Method Detail

addAttribute

public void addAttribute(Attribute a)
Add a new Attribute object to the Element

Parameters:
a - The attribute object to add to the element

getAttributeAt

public Attribute getAttributeAt(int index)
Returns the attribute at index


removeAttributeAt

public void removeAttributeAt(int index)
Removes the attribute at the given index param index The index value of the attribute to be removed


getAttributeCount

public int getAttributeCount()
Returns the number of existing attributes.


getTag

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

E.g.
<!ELEMENT hello EMPTY>

Specified by:
getTag in class DTDContent
java.lang.Error

getAttributeTag

public java.lang.String getAttributeTag()
Returns the attribute tag for the element.

E.g.
<!ATTLIST hello elementAt1 CDATA #FIXED default
    elementAt2 NMTOKEN #IMPLIED>


getTagSet

public java.lang.String getTagSet()
Returns the DTD Tag and, if attributes exist, the attribute tag for this element.

E.g.
<!ELEMENT Mixed (#PCDATA | hello*|AnotherElement+)>
<!ATTLIST Mixed elementAt1 CDATA #FIXED hello
   elementAt2 NMTOKEN #IMPLIED>


setName

public void setName(java.lang.String n)
             throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException

getName

public java.lang.String getName()
Returns the name of the element.


toString

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

getNextSequenceOrder

public int getNextSequenceOrder()

getContentModel

public java.lang.String getContentModel()
Get the Content Model for the Element


changeSimpleContentModel

public void changeSimpleContentModel(java.lang.String newCM)
Change the simple content model for a specified element. This may only be used to convert between CONTENT_EMPTY, CONTENT_PCDATA and CONTENT_ANY content models.

Parameters:
newCM - The new content model. Use the static final CONTENT_type variables.

hasAttributes

public boolean hasAttributes()
Indicates whether the Element has any attributes.


main

public static void main(java.lang.String[] args)
Debugging method. Changed regularly, and not guaranteed to work.