kiwi.text
Class SGMLElement

java.lang.Object
  |
  +--kiwi.text.SGMLElement

public class SGMLElement
extends Object

This class represents an SGML element. It includes the element tag as well as a hash table of all of the tag's parameters and their values.

An example SGML element might look like this:

<img src="image.gif" width=100 height=150>

In this case img is the tag, and width and height are the parameters, with values 100 and 150, respectively.

Version:
1.1 (05/98)
Author:
Mark Lindner, PING Software Group

Constructor Summary
SGMLElement()
          Construct a new SGMLElement.
SGMLElement(String tag, boolean end)
          Construct a new SGMLElement.
 
Method Summary
 void addParam(String name, String value)
          Add a parameter.
 Enumeration getParamNames()
          Get parameter names.
 String getParamValue(String name)
          Get a parameter value.
 String getTag()
          Get the tag.
 boolean isEnd()
          Check if this is an end tag.
 void setEnd(boolean end)
          Set the end tag flag.
 void setTag(String tag)
          Set the tag.
 String toString()
          Create a string representatin of the element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SGMLElement

public SGMLElement(String tag,
                   boolean end)
Construct a new SGMLElement.
Parameters:
tag - The element's tag.
end - A boolean flag specifying whether this is an end tag. For example, is an end tag.

SGMLElement

public SGMLElement()
Construct a new SGMLElement. The tag is set to the empty string and the end flag is set to false.
Method Detail

isEnd

public boolean isEnd()
Check if this is an end tag.
Returns:
true if this is an end tag and false otherwise.

setEnd

public void setEnd(boolean end)
Set the end tag flag.
Parameters:
end - The new end tag flag value.

setTag

public void setTag(String tag)
Set the tag.
Parameters:
tag - The new tag.

getTag

public String getTag()
Get the tag.
Returns:
The element's tag.

addParam

public void addParam(String name,
                     String value)
Add a parameter. Adds a parameter to the element's parameter list. If there is already a parameter with the given name in the list, it is replaced.
Parameters:
name - The name of the parameter.
value - The value of the parameter (may be null).

getParamValue

public String getParamValue(String name)
Get a parameter value. Returns the value for the named paramter.
Parameters:
name - The name of the parameter.
Returns:
The value of the named parameter, or null if it's a valueless parameter.

getParamNames

public Enumeration getParamNames()
Get parameter names. Returns an enumeration of strings representing the list of all parameters defined for this element.

toString

public String toString()
Create a string representatin of the element.
Overrides:
toString in class Object