All Packages Class Hierarchy This Package Previous Next Index
Class websphinx.Tag
java.lang.Object
|
+----websphinx.Region
|
+----websphinx.Tag
- public class Tag
- extends Region
Tag in an HTML page.
-
A
- Commonly useful tag names.
-
ABBREV
-
-
ACRONYM
-
-
ADDRESS
-
-
APPLET
-
-
AREA
-
-
B
-
-
BASE
-
-
BASEFONT
-
-
BDO
-
-
BGSOUND
-
-
BIG
-
-
BLINK
-
-
BLOCKQUOTE
-
-
BODY
-
-
BR
-
-
CAPTION
-
-
CENTER
-
-
CITE
-
-
CODE
-
-
COL
-
-
COLGROUP
-
-
COMMENT
-
-
DD
-
-
DEL
-
-
DFN
-
-
DIR
-
-
DIV
-
-
DL
-
-
DT
-
-
EM
-
-
EMBED
-
-
FONT
-
-
FORM
-
-
FRAME
-
-
FRAMESET
-
-
H1
-
-
H2
-
-
H3
-
-
H4
-
-
H5
-
-
H6
-
-
HEAD
-
-
HR
-
-
HTML
-
-
I
-
-
IMG
-
-
INPUT
-
-
ISINDEX
-
-
KBD
-
-
LI
-
-
LINK
-
-
LISTING
-
-
MAP
-
-
MARQUEE
-
-
MAX_LENGTH
- Length of longest tag name.
-
MENU
-
-
META
-
-
NEXTID
-
-
NOBR
-
-
NOEMBED
-
-
NOFRAMES
-
-
OBJECT
-
-
OL
-
-
OPTION
-
-
P
-
-
PARAM
-
-
PLAINTEXT
-
-
PRE
-
-
SAMP
-
-
SCRIPT
-
-
SELECT
-
-
SMALL
-
-
SPACER
-
-
STRIKE
-
-
STRONG
-
-
STYLE
-
-
SUB
-
-
SUP
-
-
TABLE
-
-
TD
-
-
TEXTAREA
-
-
TH
-
-
TITLE
-
-
TR
-
-
TT
-
-
U
-
-
UL
-
-
VAR
-
-
WBR
-
-
XMP
-
-
Tag(Page, int, int, String, boolean)
- Make a Tag.
-
countHTMLAttributes()
- Get number of HTML attributes on this tag.
-
enumerateHTMLAttributes()
- Enumerate the HTML attributes found on this tag.
-
getElement()
- Get element to which this tag is the start or end tag.
-
getHTMLAttribute(String)
- Get an HTML attribute's value.
-
getHTMLAttribute(String, String)
- Get an HTML attribute's value, with a default value if it doesn't exist.
-
getHTMLAttributes()
- Get all the HTML attributes found on this tag.
-
getTagName()
- Get tag name.
-
hasHTMLAttribute(String)
- Test if tag has an HTML attribute.
-
isBlockTag()
- Test if tag is a block-level tag.
-
isBodyTag()
- Test if tag belongs in the element.
-
isEndTag()
- Test if tag is an end tag.
-
isFlowTag()
- Test if tag is a flow-level tag.
-
isHeadTag()
- Test if tag belongs in the element.
-
isStartTag()
- Test if tag is a start tag.
-
removeHTMLAttribute(String)
- Copy this tag, removing an HTML attribute.
-
replaceHTMLAttribute(String)
- Copy this tag, setting an HTML attribute's value to TRUE.
-
replaceHTMLAttribute(String, String)
- Copy this tag, setting an HTML attribute's value.
-
toHTMLAttributeName(String)
- Convert a String to an HTML attribute name.
-
toTagName(String)
- Convert a String to a tag name.
A
public static final String A
- Commonly useful tag names.
Derived from HTML Elements
at Sandia National Labs.
ABBREV
public static final String ABBREV
ACRONYM
public static final String ACRONYM
ADDRESS
public static final String ADDRESS
APPLET
public static final String APPLET
AREA
public static final String AREA
B
public static final String B
BASE
public static final String BASE
BASEFONT
public static final String BASEFONT
BDO
public static final String BDO
BGSOUND
public static final String BGSOUND
BIG
public static final String BIG
BLINK
public static final String BLINK
BLOCKQUOTE
public static final String BLOCKQUOTE
BODY
public static final String BODY
BR
public static final String BR
CAPTION
public static final String CAPTION
CENTER
public static final String CENTER
CITE
public static final String CITE
CODE
public static final String CODE
COL
public static final String COL
COLGROUP
public static final String COLGROUP
COMMENT
public static final String COMMENT
DD
public static final String DD
DEL
public static final String DEL
DFN
public static final String DFN
DIR
public static final String DIR
DIV
public static final String DIV
DL
public static final String DL
DT
public static final String DT
EM
public static final String EM
EMBED
public static final String EMBED
FONT
public static final String FONT
FRAME
public static final String FRAME
FRAMESET
public static final String FRAMESET
FORM
public static final String FORM
H1
public static final String H1
H2
public static final String H2
H3
public static final String H3
H4
public static final String H4
H5
public static final String H5
H6
public static final String H6
HEAD
public static final String HEAD
HR
public static final String HR
HTML
public static final String HTML
I
public static final String I
IMG
public static final String IMG
INPUT
public static final String INPUT
ISINDEX
public static final String ISINDEX
KBD
public static final String KBD
LI
public static final String LI
LINK
public static final String LINK
LISTING
public static final String LISTING
MAP
public static final String MAP
MARQUEE
public static final String MARQUEE
MENU
public static final String MENU
META
public static final String META
NEXTID
public static final String NEXTID
NOBR
public static final String NOBR
NOEMBED
public static final String NOEMBED
NOFRAMES
public static final String NOFRAMES
OBJECT
public static final String OBJECT
OL
public static final String OL
OPTION
public static final String OPTION
P
public static final String P
PARAM
public static final String PARAM
PLAINTEXT
public static final String PLAINTEXT
PRE
public static final String PRE
SAMP
public static final String SAMP
SCRIPT
public static final String SCRIPT
SELECT
public static final String SELECT
SMALL
public static final String SMALL
SPACER
public static final String SPACER
STRIKE
public static final String STRIKE
STRONG
public static final String STRONG
STYLE
public static final String STYLE
SUB
public static final String SUB
SUP
public static final String SUP
TABLE
public static final String TABLE
TD
public static final String TD
TEXTAREA
public static final String TEXTAREA
TH
public static final String TH
TITLE
public static final String TITLE
TR
public static final String TR
TT
public static final String TT
U
public static final String U
UL
public static final String UL
VAR
public static final String VAR
WBR
public static final String WBR
XMP
public static final String XMP
MAX_LENGTH
public static int MAX_LENGTH
- Length of longest tag name.
Tag
public Tag(Page page,
int start,
int end,
String tagName,
boolean startTag)
- Make a Tag.
- Parameters:
- page - Page containing tag
- start - Starting offset of tag in page
- end - Ending offset of tag
- tagName - Name of tag (like "p")
- startTag - true for start tags (like "<p>"), false for end tags ("</p>")
getTagName
public String getTagName()
- Get tag name.
- Returns:
- tag name (like "p"), in lower-case, String.intern()'ed form.
getElement
public Element getElement()
- Get element to which this tag is the start or end tag.
- Returns:
- element, or null if tag has no element.
toTagName
public static String toTagName(String name)
- Convert a String to a tag name. Tag names are lower-case, intern()'ed
Strings. Thus you can compare tag names with ==, as in:
getTagName() == Tag.IMG.
- Parameters:
- name - Name to convert (e.g., "P")
- Returns:
- tag name (e.g. "p"), in lower-case, String.intern()'ed form.
isStartTag
public boolean isStartTag()
- Test if tag is a start tag. Equivalent to !isEndTag().
- Returns:
- true if and only if tag is a start tag (like "<P>")
isEndTag
public boolean isEndTag()
- Test if tag is an end tag. Equivalent to !isStartTag().
- Returns:
- true if and only if tag is a start tag (like "</P>")
isBlockTag
public boolean isBlockTag()
- Test if tag is a block-level tag. Equivalent to !isFlowTag().
- Returns:
- true if and only if tag is a block-level tag (like "<P>")
isFlowTag
public boolean isFlowTag()
- Test if tag is a flow-level tag. Equivalent to !isBlockTag().
- Returns:
- true if and only if tag is a block-level tag (like "<A>")
isHeadTag
public boolean isHeadTag()
- Test if tag belongs in the element.
- Returns:
- true if and only if tag is a HEAD-level tag (like "<TITLE>")
isBodyTag
public boolean isBodyTag()
- Test if tag belongs in the element.
- Returns:
- true if and only if tag is a BODY-level tag (like "<A>")
toHTMLAttributeName
public static String toHTMLAttributeName(String name)
- Convert a String to an HTML attribute name. Attribute names are
lower-case, intern()'ed
Strings. Thus you can compare attribute names with ==.
- Parameters:
- name - Name to convert (e.g., "HREF")
- Returns:
- tag name (e.g. "href"), in lower-case, String.intern()'ed form.
hasHTMLAttribute
public boolean hasHTMLAttribute(String name)
- Test if tag has an HTML attribute.
- Parameters:
- name - Name of HTML attribute (e.g. "HREF"). Doesn't have to be
converted with toHTMLAttributeName().
- Returns:
- true if tag has the attribute, false if not
getHTMLAttribute
public String getHTMLAttribute(String name)
- Get an HTML attribute's value.
- Parameters:
- name - Name of HTML attribute (e.g. "HREF"). Doesn't have to be
converted with toHTMLAttributeName().
- Returns:
- value of attribute if it exists, TRUE if the attribute exists but has no value, or null if tag lacks the attribute.
getHTMLAttribute
public String getHTMLAttribute(String name,
String defaultValue)
- Get an HTML attribute's value, with a default value if it doesn't exist.
- Parameters:
- name - Name of HTML attribute (e.g. "HREF"). Doesn't have to be
converted with toHTMLAttributeName().
- defaultValue - default value to return if the attribute
doesn't exist
- Returns:
- value of attribute if it exists, TRUE if the attribute exists but has no value, or defaultValue if tag lacks the attribute.
countHTMLAttributes
public int countHTMLAttributes()
- Get number of HTML attributes on this tag.
- Returns:
- number of HTML attributes
getHTMLAttributes
public String[] getHTMLAttributes()
- Get all the HTML attributes found on this tag.
- Returns:
- array of name-value pairs, alternating between
names and values. Thus array[0] is a name, array[1] is a value,
array[2] is a name, etc.
enumerateHTMLAttributes
public Enumeration enumerateHTMLAttributes()
- Enumerate the HTML attributes found on this tag.
- Returns:
- enumeration of the attribute names found on this tag.
removeHTMLAttribute
public Tag removeHTMLAttribute(String name)
- Copy this tag, removing an HTML attribute.
- Parameters:
- name - Name of HTML attribute (e.g. "HREF"). Doesn't have to be
converted with toHTMLAttributeName().
- Returns:
- copy of this tag with named attribute removed. The copy is
a region of a fresh page containing only the tag.
replaceHTMLAttribute
public Tag replaceHTMLAttribute(String name)
- Copy this tag, setting an HTML attribute's value to TRUE.
- Parameters:
- name - Name of HTML attribute (e.g. "HREF"). Doesn't have to be
converted with toHTMLAttributeName().
- Returns:
- copy of this tag with named attribute set to TRUE. The copy is
a region of a fresh page containing only the tag.
replaceHTMLAttribute
public Tag replaceHTMLAttribute(String name,
String value)
- Copy this tag, setting an HTML attribute's value.
- Parameters:
- name - Name of HTML attribute (e.g. "HREF"). Doesn't have to be
converted with toHTMLAttributeName().
- value - New value for the attribute
- Returns:
- copy of this tag with named attribute set to value.
The copy is
a region of a fresh page containing only the tag.
All Packages Class Hierarchy This Package Previous Next Index