org.eclipse.mylar.internal.tasks.core
Class HtmlTag

java.lang.Object
  extended by org.eclipse.mylar.internal.tasks.core.HtmlTag

public class HtmlTag
extends java.lang.Object

Class representing an HTML (3.2) tag and its attributes.


Nested Class Summary
static class HtmlTag.Type
          Enum class for tag types.
 
Field Summary
private  java.util.HashMap<java.lang.String,java.lang.String> attributes
          tag's attributes (keys are lowercase attribute names)
private  java.net.URL baseUrl
          tag's base url
private  boolean isEndTag
          true if the tag is a closing tag
private  boolean selfTerminating
          tag is self terminated
private  java.lang.String tagName
          tag's name
private static java.util.HashMap<java.lang.String,javax.swing.text.html.HTML.Tag> tags
           
private  javax.swing.text.html.HTML.Tag tagType
          tag type enum
 
Constructor Summary
HtmlTag()
          Basic constructor.
HtmlTag(HtmlTag htmltag)
          Copy constructor.
HtmlTag(java.lang.String s)
          Constructor.
HtmlTag(java.net.URL url)
          Constructor creating an otherwise empty tag, but with a given base url.
 
Method Summary
 java.lang.String getAttribute(java.lang.String s)
          Returns the value of a tag's attribute, or NULL if it doesn't exist.
 int getIntAttribute(java.lang.String s)
          Returns the value of a tag's attribute as an integer.
 java.lang.String getTagName()
          Returns the tag's name (e.g., "HEAD", "P", etc.).
 javax.swing.text.html.HTML.Tag getTagType()
          Returns the tag's type (linked to the tag's name).
 java.lang.StringBuffer getURLs()
           
 boolean hasAttribute(java.lang.String s)
          Returns true if the tag contains attribute with the given name.
 boolean isEndTag()
          Returns true if the tag is a closing tag.
 boolean isSelfTerminating()
           
 void setAttribute(java.lang.String name, java.lang.String value)
          Sets the value of a tag's attribute.
 void setSelfTerminating(boolean terminating)
           
 void setTagName(java.lang.String s)
          Sets the tag's name and type, if known.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tagName

private java.lang.String tagName
tag's name


tagType

private javax.swing.text.html.HTML.Tag tagType
tag type enum


isEndTag

private boolean isEndTag
true if the tag is a closing tag


attributes

private java.util.HashMap<java.lang.String,java.lang.String> attributes
tag's attributes (keys are lowercase attribute names)


baseUrl

private java.net.URL baseUrl
tag's base url


selfTerminating

private boolean selfTerminating
tag is self terminated


tags

private static java.util.HashMap<java.lang.String,javax.swing.text.html.HTML.Tag> tags
Constructor Detail

HtmlTag

public HtmlTag()
Basic constructor. The tag is uninitialized.


HtmlTag

public HtmlTag(HtmlTag htmltag)
Copy constructor.


HtmlTag

public HtmlTag(java.lang.String s)
        throws java.text.ParseException
Constructor.

Throws:
java.text.ParseException

HtmlTag

public HtmlTag(java.net.URL url)
Constructor creating an otherwise empty tag, but with a given base url.

Method Detail

getTagType

public javax.swing.text.html.HTML.Tag getTagType()
Returns the tag's type (linked to the tag's name).


getTagName

public java.lang.String getTagName()
Returns the tag's name (e.g., "HEAD", "P", etc.).


setTagName

public void setTagName(java.lang.String s)
                throws java.lang.IllegalArgumentException
Sets the tag's name and type, if known.

Throws:
java.lang.IllegalArgumentException - if the argument is null or empty string

isEndTag

public boolean isEndTag()
Returns true if the tag is a closing tag.


getIntAttribute

public int getIntAttribute(java.lang.String s)
                    throws java.lang.NumberFormatException
Returns the value of a tag's attribute as an integer.

Throws:
java.lang.NumberFormatException

getAttribute

public java.lang.String getAttribute(java.lang.String s)
Returns the value of a tag's attribute, or NULL if it doesn't exist.


hasAttribute

public boolean hasAttribute(java.lang.String s)
Returns true if the tag contains attribute with the given name.


setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
Sets the value of a tag's attribute.


getURLs

public java.lang.StringBuffer getURLs()

toString

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

setSelfTerminating

public void setSelfTerminating(boolean terminating)

isSelfTerminating

public boolean isSelfTerminating()