org.menagery.dtd
Class DTD

java.lang.Object
  |
  +--org.menagery.dtd.DTD

public class DTD
extends java.lang.Object

Implements a tree representation of a DTD.


Constructor Summary
DTD()
          Creates a new DTD.
 
Method Summary
 void addAttlist(Attlist attlist)
          Adds an Attlist to the DTD.
 void addElement(Element element)
          Adds an Element to the DTD.
 void addEntity(Entity entity)
          Adds an entity to the DTD.
 Element getElementByName(java.lang.String name)
          Get an Element from the DTD based on name.
 java.util.Enumeration getElements()
          Get an enumeration of all the elements in the DTD.
 java.util.Enumeration getEntities()
          Get the entities from the entity tree.
 Entity getEntityByName(java.lang.String name)
          Get an Entity by name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DTD

public DTD()
Creates a new DTD.
Method Detail

addElement

public void addElement(Element element)
Adds an Element to the DTD. This method does the magic that actually adds the element to the DTD, asks the tree to rearrange itself so that child nodes are under their parents, rewrites nodes as needed, etc. Collisions should replace the existing node in the Elements hashtable and the tree.
Parameters:
element - The Element object to be added.

getElementByName

public Element getElementByName(java.lang.String name)
Get an Element from the DTD based on name.
Parameters:
name - The element name to retrieve.
Returns:
The Element object, or null if not found.

getElements

public java.util.Enumeration getElements()
Get an enumeration of all the elements in the DTD.
Returns:
An Enumeration of all the elements in the DTD object.

addAttlist

public void addAttlist(Attlist attlist)
Adds an Attlist to the DTD. This method associates the attribute list with the correct element. Note that if an attlist is added BEFORE the element it references, it will NOT be associated and will be lost.
Parameters:
attlist - The Attlist object to be added

addEntity

public void addEntity(Entity entity)
Adds an entity to the DTD. This method adds the entity tag to the DTD. Because this is a non-validating parser, the entity is only stored and not properly expanded.
Parameters:
entity - The Entity object to be added.

getEntities

public java.util.Enumeration getEntities()
Get the entities from the entity tree.
Returns:
The Entity objects in an Enumeration.

getEntityByName

public Entity getEntityByName(java.lang.String name)
Get an Entity by name.
Parameters:
name - The entity name.
Returns:
The Entity object matching the name, or null if not found.