Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

cvu.html
Class TagToken  view TagToken download TagToken.java

java.lang.Object
  extended bycvu.html.TagToken

public class TagToken
extends java.lang.Object

This represents a single HTML tag. Each TagToken has a name and a list of attributes and values.


Field Summary
private  AttributeList attr
          Stores a list of attributes and their values.
private  boolean end
          Indicates whether the TagToken is an end-token.
static char ESCAPE
          Identifies the escape character.
private  java.lang.String name
          Stores the name of the TagToken.
static char QUOTE
          Identifies the quotation character.
 
Constructor Summary
TagToken(java.lang.String line)
          Constructs a new TagToken converting the specified string into a token name and a list of attributes with values.
 
Method Summary
 java.lang.String getAttribute(java.lang.String name)
          Returns the value of the specified attribute or null if the attribute does not exist.
 AttributeList getAttributes()
          Returns the attribute list of the TagToken.
 java.lang.String getAttributeToString(java.lang.String name)
          Returns a string version of the attribute and its value.
 java.lang.String getName()
          Returns the name of the TagToken.
 java.lang.String getQuotedAttribute(java.lang.String name)
          Returns an attribute with all double quote characters escaped with a backslash.
 boolean isAttribute(java.lang.String name)
          Returns true if the given attribute exists.
 boolean isEndTag()
          Indicates whether this token is an end tag.
private  boolean isWhitespace(char c)
          Returns true if the given character is considered to be whitespace.
private  void setAttribute(java.lang.String s)
          Adds a attribute to the list using the given string.
private  void setAttribute(java.lang.String name, java.lang.String value)
          Adds a attribute and value to the list.
private  void setName(java.lang.String name)
          Sets the name of the token and also whether it is a begin or an end token.
private  void tokenizeAttributes(java.lang.String args)
          Tokenizes the given string and uses the resulting vector to to build up the TagToken's attribute list.
private  java.util.Vector tokenizeString(java.lang.String s)
          This method tokenizes the given string and returns a vector of its constituent tokens.
 java.lang.String toString()
          Returns a string version of the TagToken.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ESCAPE

public static final char ESCAPE
Identifies the escape character.

See Also:
Constant Field Values

QUOTE

public static final char QUOTE
Identifies the quotation character.

See Also:
Constant Field Values

name

private java.lang.String name
Stores the name of the TagToken.


end

private boolean end
Indicates whether the TagToken is an end-token.


attr

private AttributeList attr
Stores a list of attributes and their values.

Constructor Detail

TagToken

public TagToken(java.lang.String line)
Constructs a new TagToken converting the specified string into a token name and a list of attributes with values.

Method Detail

getName

public java.lang.String getName()
Returns the name of the TagToken.


getAttributes

public AttributeList getAttributes()
Returns the attribute list of the TagToken.


isEndTag

public boolean isEndTag()
Indicates whether this token is an end tag.


isAttribute

public boolean isAttribute(java.lang.String name)
Returns true if the given attribute exists.


getAttribute

public java.lang.String getAttribute(java.lang.String name)
Returns the value of the specified attribute or null if the attribute does not exist.


getQuotedAttribute

public java.lang.String getQuotedAttribute(java.lang.String name)
Returns an attribute with all double quote characters escaped with a backslash.


getAttributeToString

public java.lang.String getAttributeToString(java.lang.String name)
Returns a string version of the attribute and its value.


toString

public java.lang.String toString()
Returns a string version of the TagToken.


setName

private void setName(java.lang.String name)
Sets the name of the token and also whether it is a begin or an end token.


setAttribute

private void setAttribute(java.lang.String name,
                          java.lang.String value)
Adds a attribute and value to the list.


setAttribute

private void setAttribute(java.lang.String s)
Adds a attribute to the list using the given string. The string may either be in the form 'attribute' or 'attribute=value'.


tokenizeAttributes

private void tokenizeAttributes(java.lang.String args)
Tokenizes the given string and uses the resulting vector to to build up the TagToken's attribute list.


tokenizeString

private java.util.Vector tokenizeString(java.lang.String s)
This method tokenizes the given string and returns a vector of its constituent tokens. It understands quoting and character escapes.


isWhitespace

private boolean isWhitespace(char c)
Returns true if the given character is considered to be whitespace.