com.cburch.editor.scanners
Class HtmlTag

java.lang.Object
  extended by com.cburch.editor.scanners.HtmlTag

public class HtmlTag
extends java.lang.Object

Represents the information contained within a tag in an HTML document.

Version:
0.1 2005-05-31
Author:
Carl Burch

Method Summary
 boolean containsAttribute(java.lang.String name)
          Returns true if this tag mentions the requested attribute.
static HtmlTag create(java.lang.String text)
          Generates a tag containing all the data encapsulated in the given HTML string.
 java.lang.String getAttribute(java.lang.String name)
          Returns the value associated with the attribute, or null if the attribute was not mentioned or was mentioned with no corresponding value (as in "<INPUT READONLY>").
 java.lang.String getError()
          Returns an error message explaining any problems with the HTML tag, or null if the HTML tag appears to be valid.
 java.lang.String getName()
          Returns the name within the tag, normalized to be in all capital letters.
 boolean isDeprecated()
          Returns true if the HTML tag is deprecated in HTML 4.01.
 boolean isEndTag()
          Returns true if this tag ends its element.
 boolean isKnown()
          Returns true if the HTML tag is defined in the HTML 4.01 standard.
 boolean isStartTag()
          Returns true if this tag starts its element.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isStartTag

public boolean isStartTag()
Returns true if this tag starts its element.

Returns:
true if the tag starts its element.

isEndTag

public boolean isEndTag()
Returns true if this tag ends its element. It is possible for a tag to both start and end the element if it uses the XML-like syntax "<TAG ... />".

Returns:
true if this tag ends its element.

getName

public java.lang.String getName()
Returns the name within the tag, normalized to be in all capital letters.

Returns:
the name within the tag.

containsAttribute

public boolean containsAttribute(java.lang.String name)
Returns true if this tag mentions the requested attribute.

Parameters:
name - the attribute name query.
Returns:
true if the attribute is mentioned within the tag.

getAttribute

public java.lang.String getAttribute(java.lang.String name)
Returns the value associated with the attribute, or null if the attribute was not mentioned or was mentioned with no corresponding value (as in "<INPUT READONLY>").

Parameters:
name - the attribute name query.
Returns:
the value associated with the attribute name, or null if no value is associated.

getError

public java.lang.String getError()
Returns an error message explaining any problems with the HTML tag, or null if the HTML tag appears to be valid.

Returns:
an error message if the tag interpretation was not successful, or null if it was successful.

isDeprecated

public boolean isDeprecated()
Returns true if the HTML tag is deprecated in HTML 4.01.

Returns:
true if the tag is deprecated.

isKnown

public boolean isKnown()
Returns true if the HTML tag is defined in the HTML 4.01 standard.

Returns:
true if the HTML tag is defined in the HTML 4.01 standard.

create

public static HtmlTag create(java.lang.String text)
Generates a tag containing all the data encapsulated in the given HTML string.

Parameters:
text - a string of HTML, including the enclosing angle brackets.
Returns:
an object containing all information encapsulated in the string.