net.sourceforge.apphere.util.html
Class HtmlTag

java.lang.Object
  extended bynet.sourceforge.apphere.util.html.HtmlTag

public class HtmlTag
extends java.lang.Object

HtmlTag is a helper class to store parsed tag information.

Version:
2.01 09/12/97
Author:
Arthur Do
See Also:
adc.parser.HtmlStreamTokenizer

Field Summary
static java.lang.String P_ALIGN
           
static java.lang.String P_BACKGROUND
           
static java.lang.String P_BORDER
           
static java.lang.String P_CHECKED
           
static java.lang.String P_CLEAR
           
static java.lang.String P_CODE
           
static java.lang.String P_COLS
           
static java.lang.String P_COLSPAN
           
static java.lang.String P_FACE
           
static java.lang.String P_HEIGHT
           
static java.lang.String P_HREF
           
static java.lang.String P_LANGUAGE
           
static java.lang.String P_LOWSRC
           
static java.lang.String P_MAXLENGTH
           
static java.lang.String P_MULTIPLE
           
static java.lang.String P_NAME
           
static java.lang.String P_ROWS
           
static java.lang.String P_ROWSPAN
           
static java.lang.String P_SIZE
           
static java.lang.String P_SRC
           
static java.lang.String P_TARGET
           
static java.lang.String P_TYPE
           
static java.lang.String P_VALUE
           
static java.lang.String P_WIDTH
           
static int T__DOCTYPE
          
static int T_A
           
static int T_ABBREV
           
static int T_ACRONYM
           
static int T_ADDRESS
           
static int T_APPLET
           
static int T_AREA
           
static int T_AU
           
static int T_B
           
static int T_BANNER
           
static int T_BASE
           
static int T_BASEFONT
           
static int T_BGSOUND
           
static int T_BIG
           
static int T_BLINK
           
static int T_BLOCKQUOTE
           
static int T_BODY
           
static int T_BR
           
static int T_CAPTION
           
static int T_CENTER
           
static int T_CITE
           
static int T_CODE
           
static int T_COL
           
static int T_COLGROUP
           
static int T_CREDIT
           
static int T_DD
           
static int T_DEL
           
static int T_DFN
           
static int T_DIR
           
static int T_DIV
           
static int T_DL
           
static int T_DT
           
static int T_EM
           
static int T_EMBED
           
static int T_FIG
           
static int T_FN
           
static int T_FONT
           
static int T_FORM
           
static int T_FRAME
           
static int T_FRAMESET
           
static int T_H1
           
static int T_H2
           
static int T_H3
           
static int T_H4
           
static int T_H5
           
static int T_H6
           
static int T_HEAD
           
static int T_HR
           
static int T_HTML
           
static int T_I
           
static int T_IMG
           
static int T_INPUT
           
static int T_INS
           
static int T_ISINDEX
           
static int T_KBD
           
static int T_LANG
           
static int T_LH
           
static int T_LI
           
static int T_LINK
           
static int T_MAP
           
static int T_MARQUEE
           
static int T_MENU
           
static int T_META
           
static int T_NEXTID
           
static int T_NOBR
           
static int T_NOEMBED
           
static int T_NOFRAME
           
static int T_NOFRAMES
           
static int T_NOTE
           
static int T_OBJECT
           
static int T_OL
           
static int T_OPTION
           
static int T_OVERLAY
           
static int T_P
           
static int T_PARAM
           
static int T_PERSON
           
static int T_PRE
           
static int T_Q
           
static int T_RANGE
           
static int T_S
           
static int T_SAMP
           
static int T_SCRIPT
           
static int T_SELECT
           
static int T_SMALL
           
static int T_SPOT
           
static int T_STRONG
           
static int T_STYLE
           
static int T_SUB
           
static int T_SUP
           
static int T_TAB
           
static int T_TABLE
           
static int T_TBODY
           
static int T_TD
           
static int T_TEXTAREA
           
static int T_TFOOT
           
static int T_TH
           
static int T_THEAD
           
static int T_TITLE
           
static int T_TR
           
static int T_TT
           
static int T_U
           
static int T_UL
           
static int T_UNKNOWN
           
static int T_VAR
           
static int T_WBR
           
 
Constructor Summary
HtmlTag()
           
HtmlTag(HtmlTag orig)
           
 
Method Summary
 int getIntParam(java.lang.String name)
           
 java.lang.String getParam(java.lang.String name)
          Looks up a tag param name and returns the associated value, if any.
 java.lang.String getTagString()
           
 int getTagType()
           
 boolean hasParam(java.lang.String name)
           
 boolean isEndTag()
           
 void removeParam(java.lang.String name)
          Remove association of a param name with a value.
 void reset()
          Reset tag to original state, as if it was just constructed.
 void setParam(java.lang.String name, java.lang.String value)
          Associates a param name with a value.
 void setParam(java.lang.String name, java.lang.String value, java.lang.String originalName)
          Associates a param name with a value, preserving the original name.
 void setTag(java.lang.String tag)
          Sets the tag name.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

T_UNKNOWN

public static final int T_UNKNOWN
See Also:
Constant Field Values

T_A

public static final int T_A
See Also:
Constant Field Values

T_ABBREV

public static final int T_ABBREV
See Also:
Constant Field Values

T_ACRONYM

public static final int T_ACRONYM
See Also:
Constant Field Values

T_ADDRESS

public static final int T_ADDRESS
See Also:
Constant Field Values

T_APPLET

public static final int T_APPLET
See Also:
Constant Field Values

T_AREA

public static final int T_AREA
See Also:
Constant Field Values

T_AU

public static final int T_AU
See Also:
Constant Field Values

T_B

public static final int T_B
See Also:
Constant Field Values

T_BANNER

public static final int T_BANNER
See Also:
Constant Field Values

T_BASE

public static final int T_BASE
See Also:
Constant Field Values

T_BASEFONT

public static final int T_BASEFONT
See Also:
Constant Field Values

T_BGSOUND

public static final int T_BGSOUND
See Also:
Constant Field Values

T_BIG

public static final int T_BIG
See Also:
Constant Field Values

T_BLINK

public static final int T_BLINK
See Also:
Constant Field Values

T_BLOCKQUOTE

public static final int T_BLOCKQUOTE
See Also:
Constant Field Values

T_BODY

public static final int T_BODY
See Also:
Constant Field Values

T_BR

public static final int T_BR
See Also:
Constant Field Values

T_CAPTION

public static final int T_CAPTION
See Also:
Constant Field Values

T_CENTER

public static final int T_CENTER
See Also:
Constant Field Values

T_CITE

public static final int T_CITE
See Also:
Constant Field Values

T_CODE

public static final int T_CODE
See Also:
Constant Field Values

T_COL

public static final int T_COL
See Also:
Constant Field Values

T_COLGROUP

public static final int T_COLGROUP
See Also:
Constant Field Values

T_CREDIT

public static final int T_CREDIT
See Also:
Constant Field Values

T_DD

public static final int T_DD
See Also:
Constant Field Values

T_DEL

public static final int T_DEL
See Also:
Constant Field Values

T_DFN

public static final int T_DFN
See Also:
Constant Field Values

T_DIR

public static final int T_DIR
See Also:
Constant Field Values

T_DIV

public static final int T_DIV
See Also:
Constant Field Values

T_DL

public static final int T_DL
See Also:
Constant Field Values

T_DT

public static final int T_DT
See Also:
Constant Field Values

T_EM

public static final int T_EM
See Also:
Constant Field Values

T_EMBED

public static final int T_EMBED
See Also:
Constant Field Values

T_FIG

public static final int T_FIG
See Also:
Constant Field Values

T_FN

public static final int T_FN
See Also:
Constant Field Values

T_FONT

public static final int T_FONT
See Also:
Constant Field Values

T_FORM

public static final int T_FORM
See Also:
Constant Field Values

T_FRAME

public static final int T_FRAME
See Also:
Constant Field Values

T_FRAMESET

public static final int T_FRAMESET
See Also:
Constant Field Values

T_H1

public static final int T_H1
See Also:
Constant Field Values

T_H2

public static final int T_H2
See Also:
Constant Field Values

T_H3

public static final int T_H3
See Also:
Constant Field Values

T_H4

public static final int T_H4
See Also:
Constant Field Values

T_H5

public static final int T_H5
See Also:
Constant Field Values

T_H6

public static final int T_H6
See Also:
Constant Field Values

T_HEAD

public static final int T_HEAD
See Also:
Constant Field Values

T_HTML

public static final int T_HTML
See Also:
Constant Field Values

T_HR

public static final int T_HR
See Also:
Constant Field Values

T_I

public static final int T_I
See Also:
Constant Field Values

T_IMG

public static final int T_IMG
See Also:
Constant Field Values

T_INPUT

public static final int T_INPUT
See Also:
Constant Field Values

T_INS

public static final int T_INS
See Also:
Constant Field Values

T_ISINDEX

public static final int T_ISINDEX
See Also:
Constant Field Values

T_KBD

public static final int T_KBD
See Also:
Constant Field Values

T_LANG

public static final int T_LANG
See Also:
Constant Field Values

T_LH

public static final int T_LH
See Also:
Constant Field Values

T_LI

public static final int T_LI
See Also:
Constant Field Values

T_LINK

public static final int T_LINK
See Also:
Constant Field Values

T_MAP

public static final int T_MAP
See Also:
Constant Field Values

T_MARQUEE

public static final int T_MARQUEE
See Also:
Constant Field Values

T_MENU

public static final int T_MENU
See Also:
Constant Field Values

T_META

public static final int T_META
See Also:
Constant Field Values

T_NEXTID

public static final int T_NEXTID
See Also:
Constant Field Values

T_NOBR

public static final int T_NOBR
See Also:
Constant Field Values

T_NOEMBED

public static final int T_NOEMBED
See Also:
Constant Field Values

T_NOFRAME

public static final int T_NOFRAME
See Also:
Constant Field Values

T_NOFRAMES

public static final int T_NOFRAMES
See Also:
Constant Field Values

T_NOTE

public static final int T_NOTE
See Also:
Constant Field Values

T_OBJECT

public static final int T_OBJECT
See Also:
Constant Field Values

T_OL

public static final int T_OL
See Also:
Constant Field Values

T_OPTION

public static final int T_OPTION
See Also:
Constant Field Values

T_OVERLAY

public static final int T_OVERLAY
See Also:
Constant Field Values

T_P

public static final int T_P
See Also:
Constant Field Values

T_PARAM

public static final int T_PARAM
See Also:
Constant Field Values

T_PERSON

public static final int T_PERSON
See Also:
Constant Field Values

T_PRE

public static final int T_PRE
See Also:
Constant Field Values

T_Q

public static final int T_Q
See Also:
Constant Field Values

T_RANGE

public static final int T_RANGE
See Also:
Constant Field Values

T_S

public static final int T_S
See Also:
Constant Field Values

T_SAMP

public static final int T_SAMP
See Also:
Constant Field Values

T_SCRIPT

public static final int T_SCRIPT
See Also:
Constant Field Values

T_SELECT

public static final int T_SELECT
See Also:
Constant Field Values

T_SMALL

public static final int T_SMALL
See Also:
Constant Field Values

T_SPOT

public static final int T_SPOT
See Also:
Constant Field Values

T_STRONG

public static final int T_STRONG
See Also:
Constant Field Values

T_STYLE

public static final int T_STYLE
See Also:
Constant Field Values

T_SUB

public static final int T_SUB
See Also:
Constant Field Values

T_SUP

public static final int T_SUP
See Also:
Constant Field Values

T_TAB

public static final int T_TAB
See Also:
Constant Field Values

T_TABLE

public static final int T_TABLE
See Also:
Constant Field Values

T_TBODY

public static final int T_TBODY
See Also:
Constant Field Values

T_TD

public static final int T_TD
See Also:
Constant Field Values

T_TEXTAREA

public static final int T_TEXTAREA
See Also:
Constant Field Values

T_TFOOT

public static final int T_TFOOT
See Also:
Constant Field Values

T_TH

public static final int T_TH
See Also:
Constant Field Values

T_THEAD

public static final int T_THEAD
See Also:
Constant Field Values

T_TITLE

public static final int T_TITLE
See Also:
Constant Field Values

T_TR

public static final int T_TR
See Also:
Constant Field Values

T_TT

public static final int T_TT
See Also:
Constant Field Values

T_U

public static final int T_U
See Also:
Constant Field Values

T_UL

public static final int T_UL
See Also:
Constant Field Values

T_VAR

public static final int T_VAR
See Also:
Constant Field Values

T_WBR

public static final int T_WBR
See Also:
Constant Field Values

T__DOCTYPE

public static final int T__DOCTYPE

See Also:
Constant Field Values

P_ALIGN

public static final java.lang.String P_ALIGN

P_BACKGROUND

public static final java.lang.String P_BACKGROUND

P_BORDER

public static final java.lang.String P_BORDER

P_CHECKED

public static final java.lang.String P_CHECKED

P_CLEAR

public static final java.lang.String P_CLEAR

P_CODE

public static final java.lang.String P_CODE

P_COLS

public static final java.lang.String P_COLS

P_COLSPAN

public static final java.lang.String P_COLSPAN

P_FACE

public static final java.lang.String P_FACE

P_HEIGHT

public static final java.lang.String P_HEIGHT

P_HREF

public static final java.lang.String P_HREF

P_LANGUAGE

public static final java.lang.String P_LANGUAGE

P_LOWSRC

public static final java.lang.String P_LOWSRC

P_MAXLENGTH

public static final java.lang.String P_MAXLENGTH

P_MULTIPLE

public static final java.lang.String P_MULTIPLE

P_NAME

public static final java.lang.String P_NAME

P_ROWS

public static final java.lang.String P_ROWS

P_ROWSPAN

public static final java.lang.String P_ROWSPAN

P_SIZE

public static final java.lang.String P_SIZE

P_SRC

public static final java.lang.String P_SRC

P_TARGET

public static final java.lang.String P_TARGET

P_TYPE

public static final java.lang.String P_TYPE

P_VALUE

public static final java.lang.String P_VALUE

P_WIDTH

public static final java.lang.String P_WIDTH
Constructor Detail

HtmlTag

public HtmlTag()

HtmlTag

public HtmlTag(HtmlTag orig)
Method Detail

setTag

public void setTag(java.lang.String tag)
            throws HtmlException
Sets the tag name.

Parameters:
tag - name of tag, e.g. "img"
Throws:
HtmlException - if malformed tag.

getTagType

public int getTagType()
Returns:
tag type, e.g. one of the T_ constants.

getTagString

public java.lang.String getTagString()
Returns:
tag name, the same name as passed to the constructor.

isEndTag

public boolean isEndTag()
Returns:
this is an end tag or not, i.e. if the tag has a slash before the name.

getParam

public java.lang.String getParam(java.lang.String name)
Looks up a tag param name and returns the associated value, if any. Try to use the predefined P_ constants.

Parameters:
name - name of param, must be lowercase
Returns:
the value associated with the name, or null.

hasParam

public boolean hasParam(java.lang.String name)

getIntParam

public int getIntParam(java.lang.String name)
                throws java.lang.NumberFormatException
Throws:
java.lang.NumberFormatException

setParam

public void setParam(java.lang.String name,
                     java.lang.String value)
Associates a param name with a value.

Parameters:
name - name of param, the convention is to use a lowercase name
value - value associated with name

setParam

public void setParam(java.lang.String name,
                     java.lang.String value,
                     java.lang.String originalName)
Associates a param name with a value, preserving the original name.

Parameters:
name - name of param, the convention is to use a lowercase name
value - value associated with name
originalName - preserve the orginal case of name

removeParam

public void removeParam(java.lang.String name)
Remove association of a param name with a value.

Parameters:
name - name of param to remove, the convention is to use a lowercase name

toString

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

reset

public void reset()
Reset tag to original state, as if it was just constructed.