webapplicationtestcase
Class Tag

java.lang.Object
  extended by webapplicationtestcase.Tag

public class Tag
extends java.lang.Object

Represents an HTML tag.

Version:
1.0
Author:
Jason Edwards

Constructor Summary
Tag()
          Constructs a new instance.
Tag(java.lang.String text)
          Constructs a new instance with the given tag text.
 
Method Summary
 java.util.Map getAttributes()
          A map of the attributes of this tag.
 java.lang.String getName()
          Accessor for the name of this tag.
 int getNodeId()
          Accessor for the index of this node in HttpResponse.nodes
 java.lang.String getText()
          Accessor for the text of the tag.
 boolean isComment()
           
 boolean isEndTag()
           
 boolean isSelfClosing()
          Specifies if this tag is self closing.
 void setNodeId(int nodeId)
          Setter for the index of this node in HttpResponse.nodes
 void setText(java.lang.String text)
          Setter for the text of the tag.
 java.lang.String toString()
          Returns a string representation of this tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Tag

public Tag()
Constructs a new instance.


Tag

public Tag(java.lang.String text)
Constructs a new instance with the given tag text.

Parameters:
text - the text of the tag.
Method Detail

getNodeId

public int getNodeId()
Accessor for the index of this node in HttpResponse.nodes

Returns:
the index of this node

setNodeId

public void setNodeId(int nodeId)
Setter for the index of this node in HttpResponse.nodes

Parameters:
nodeId - the index of this node

getText

public java.lang.String getText()
Accessor for the text of the tag.

Returns:
the text of this tag.

setText

public void setText(java.lang.String text)
Setter for the text of the tag. This is not the text contained between tags, but the text between the < and >. An example would be "span class=\"error\" id=\"errorMessage\"",. This method parses the tag into

Parameters:
text - the text of the tag.

isComment

public boolean isComment()
Returns:
true if this tag is a comment, false otherwise.

isEndTag

public boolean isEndTag()
Returns:
true if this tag is a closing, false otherwise.

isSelfClosing

public boolean isSelfClosing()
Specifies if this tag is self closing.

Returns:
true if this is a self closing tag, false otherwise.

getName

public java.lang.String getName()
Accessor for the name of this tag.

Returns:
a String containing the name of this tag, e.g. "span", "div", or "a".

getAttributes

public java.util.Map getAttributes()
A map of the attributes of this tag.

Returns:
a map of the attributes of this tag, where the key is a String containing the name of the attribute, and the value is a String containing the value of the attribute.

toString

public java.lang.String toString()
Returns a string representation of this tag.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this tag.