org.erowid.sperowider.htmlshredding
Class HTMLTag

java.lang.Object
  extended byorg.erowid.sperowider.htmlshredding.HTMLTag
All Implemented Interfaces:
HTMLElement
Direct Known Subclasses:
HTMLMetaTag, ScriptTag

public class HTMLTag
extends Object
implements HTMLElement

Represents a generic HTML Tag, which consists of a name, lead and following characters (for closing tags, or for self closing tags), and a collection of attributes, some of which have values.

Version:
$Header: /cvsroot/sperowider/SPEROWIDER_MODULE/javasource/org/erowid/sperowider/htmlshredding/HTMLTag.java,v 1.5 2005/06/08 09:12:28 gurustu Exp $
Author:
Stu Statman


Constructor Summary
HTMLTag()
          Creates an empty tag
HTMLTag(String tagName)
          This is instantiated with the tag name (the command at the start of the tag) *only*.
 
Method Summary
 void addAttributesFromTag(HTMLTag tag)
          Adds in the attributes from one tag into this one.
 void addHTMLTagAttribute(HTMLTagAttribute hta)
          Adds a new HTMLTagAttribute to this tag
 String getFollowChar()
          Returns the follow character for this tag.
 HTMLTagAttribute getHTMLTagAttribute(String name)
          Returns the HTMLTagAttribute with the given attribute name.
 Iterator getHTMLTagAttributes()
          Returns an Iterator pointing to the list of HTMLTagAttribute
 String getLeadChar()
          Returns the lead character.
 String getTagName()
          Returns the tag name, the thing that starts a tag off (the "a" in "", etc.)
 void setFollowChar(char value)
          Sets the follow character for this tag.
 void setLeadChar(char value)
          Sets the lead character for this tag.
 void setTagName(String name)
          Sets the tag name, the thing that starts a tag off (the "a" in "", etc.)
 String toString()
          Returns the text of this tag
 void write(Writer w)
          Writes the text version of this tag to the passed in Writer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HTMLTag

public HTMLTag(String tagName)
This is instantiated with the tag name (the command at the start of the tag) *only*. Don't include the rest of the tag.


HTMLTag

public HTMLTag()
Creates an empty tag

Method Detail

setLeadChar

public void setLeadChar(char value)
Sets the lead character for this tag. Usually this would be either blank or "/" for closing tags.


setFollowChar

public void setFollowChar(char value)
Sets the follow character for this tag. Usually this would be either blank or "/" for self closing tags.


getLeadChar

public String getLeadChar()
Returns the lead character. Usually this would be either blank or "/" for closing tags.


getFollowChar

public String getFollowChar()
Returns the follow character for this tag. Usually this would be either blank or "/" for self closing tags.


setTagName

public void setTagName(String name)
Sets the tag name, the thing that starts a tag off (the "a" in "", etc.)


getTagName

public String getTagName()
Returns the tag name, the thing that starts a tag off (the "a" in "", etc.)


getHTMLTagAttributes

public Iterator getHTMLTagAttributes()
Returns an Iterator pointing to the list of HTMLTagAttribute


addAttributesFromTag

public void addAttributesFromTag(HTMLTag tag)
Adds in the attributes from one tag into this one.


addHTMLTagAttribute

public void addHTMLTagAttribute(HTMLTagAttribute hta)
Adds a new HTMLTagAttribute to this tag


getHTMLTagAttribute

public HTMLTagAttribute getHTMLTagAttribute(String name)
Returns the HTMLTagAttribute with the given attribute name.


write

public void write(Writer w)
           throws IOException
Writes the text version of this tag to the passed in Writer

Specified by:
write in interface HTMLElement
Parameters:
w -
Throws:
IOException

toString

public String toString()
Returns the text of this tag


spero logo small Sperowider is
© 2005 Erowid.org