public class HTMLElement extends Element
Modifier and Type | Field and Description |
---|---|
static int |
ATTR_ABBR |
static int |
ATTR_ACCESSKEY |
static int |
ATTR_ACTION |
static int |
ATTR_ALIGN |
static int |
ATTR_ALT |
static int |
ATTR_AXIS |
static int |
ATTR_BGCOLOR |
static int |
ATTR_BORDER |
static int |
ATTR_CELLPADDING |
static int |
ATTR_CELLSPACING |
static int |
ATTR_CHARSET |
static int |
ATTR_CHECKED |
static int |
ATTR_CITE |
static int |
ATTR_CLASS |
static int |
ATTR_COLOR |
static int |
ATTR_COLS |
static int |
ATTR_COLSPAN |
static int |
ATTR_CONTENT |
static int |
ATTR_COORDS |
static int |
ATTR_DIR |
static int |
ATTR_DISABLED |
static int |
ATTR_EMPTYOK |
static int |
ATTR_ENCTYPE |
static int |
ATTR_FACE |
static int |
ATTR_FOR |
static int |
ATTR_FORMAT |
static int |
ATTR_FRAME |
static int |
ATTR_HEADERS |
static int |
ATTR_HEIGHT |
static int |
ATTR_HREF |
static int |
ATTR_HREFLANG |
static int |
ATTR_HSPACE |
static int |
ATTR_HTTPEQUIV |
static int |
ATTR_ID |
static int |
ATTR_ISMAP |
static int |
ATTR_ISTYLE |
static int |
ATTR_LABEL |
static int |
ATTR_LANG |
static int |
ATTR_LINK |
static int |
ATTR_LOCALSRC |
static int |
ATTR_LONGDESC |
static int |
ATTR_MAXLENGTH |
static int |
ATTR_MEDIA |
static int |
ATTR_METHOD |
static int |
ATTR_MULTIPLE |
static int |
ATTR_NAME |
static int |
ATTR_READONLY |
static int |
ATTR_REL |
static int |
ATTR_REV |
static int |
ATTR_ROWS |
static int |
ATTR_ROWSPAN |
static int |
ATTR_RULES |
static int |
ATTR_SCHEME |
static int |
ATTR_SCOPE |
static int |
ATTR_SELECTED |
static int |
ATTR_SHAPE |
static int |
ATTR_SIZE |
static int |
ATTR_SRC |
static int |
ATTR_START |
static int |
ATTR_STYLE |
static int |
ATTR_SUMMARY |
static int |
ATTR_TABINDEX |
static int |
ATTR_TEXT |
static int |
ATTR_TITLE |
static int |
ATTR_TYPE |
static int |
ATTR_USEMAP |
static int |
ATTR_VALIGN |
static int |
ATTR_VALUE |
static int |
ATTR_VERSION |
static int |
ATTR_VSPACE |
static int |
ATTR_WIDTH |
static int |
ATTR_XMLLANG |
static int |
ATTR_XMLNS |
static int |
ATTR_XMLSPACE |
static int |
COLOR_AQUA |
static int |
COLOR_BLACK |
static int |
COLOR_BLUE |
static int |
COLOR_FUCHSIA |
static int |
COLOR_GRAY |
static int |
COLOR_GREEN |
static int |
COLOR_LIME |
static int |
COLOR_MAROON |
static int |
COLOR_NAVY |
static int |
COLOR_OLIVE |
static int |
COLOR_ORANGE |
static int |
COLOR_PURPLE |
static int |
COLOR_RED |
static int |
COLOR_SILVER |
static int |
COLOR_TEAL |
static int |
COLOR_WHITE |
static int |
COLOR_YELLOW |
static int |
TAG_A |
static int |
TAG_ABBR |
static int |
TAG_ACRONYM |
static int |
TAG_ADDRESS |
static int |
TAG_AREA |
static int |
TAG_B |
static int |
TAG_BASE |
static int |
TAG_BASEFONT |
static int |
TAG_BIG |
static int |
TAG_BLOCKQUOTE |
static int |
TAG_BODY |
static int |
TAG_BR |
static int |
TAG_BUTTON |
static int |
TAG_CAPTION |
static int |
TAG_CENTER |
static int |
TAG_CITE |
static int |
TAG_CODE |
static int |
TAG_CSS_ILLEGAL_SELECTOR |
static int |
TAG_CSS_SELECTOR |
static int |
TAG_DD |
static int |
TAG_DEL |
static int |
TAG_DFN |
static int |
TAG_DIR |
static int |
TAG_DIV |
static int |
TAG_DL |
static int |
TAG_DT |
static int |
TAG_EM |
static int |
TAG_FIELDSET |
static int |
TAG_FONT |
static int |
TAG_FORM |
static int |
TAG_H1 |
static int |
TAG_H2 |
static int |
TAG_H3 |
static int |
TAG_H4 |
static int |
TAG_H5 |
static int |
TAG_H6 |
static int |
TAG_HEAD |
static int |
TAG_HR |
static int |
TAG_HTML |
static int |
TAG_I |
static int |
TAG_IMG |
static int |
TAG_INPUT |
static int |
TAG_INS |
static int |
TAG_KBD |
static int |
TAG_LABEL |
static int |
TAG_LEGEND |
static int |
TAG_LI |
static int |
TAG_LINK |
static int |
TAG_MAP |
static int |
TAG_MENU |
static int |
TAG_META |
static int |
TAG_NOFRAMES |
static int |
TAG_NOSCRIPT |
static int |
TAG_OBJECT |
static int |
TAG_OL |
static int |
TAG_OPTGROUP |
static int |
TAG_OPTION |
static int |
TAG_P |
static int |
TAG_PARAM |
static int |
TAG_PRE |
static int |
TAG_Q |
static int |
TAG_S |
static int |
TAG_SAMP |
static int |
TAG_SELECT |
static int |
TAG_SMALL |
static int |
TAG_SPAN |
static int |
TAG_STRIKE |
static int |
TAG_STRONG |
static int |
TAG_STYLE |
static int |
TAG_SUB |
static int |
TAG_SUP |
static int |
TAG_TABLE |
static int |
TAG_TBODY |
static int |
TAG_TD |
static int |
TAG_TEXT |
static int |
TAG_TEXTAREA |
static int |
TAG_TFOOT |
static int |
TAG_TH |
static int |
TAG_THEAD |
static int |
TAG_TITLE |
static int |
TAG_TR |
static int |
TAG_TT |
static int |
TAG_U |
static int |
TAG_UL |
static int |
TAG_UNSUPPORTED |
static int |
TAG_VAR |
DEPTH_INFINITE
Modifier | Constructor and Description |
---|---|
protected |
HTMLElement()
Constructs and HTMLElement without specifying a name.
|
|
HTMLElement(String tagName)
Constructor for HTMLElement.
|
|
HTMLElement(String tagName,
boolean isTextElement)
Constructor for HTMLElement.
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(Element childElement)
Adds the specified Element as a child to this element.
|
String |
getAttribute(String name)
Returns the attribute value by its name (or null if it wasn't defined for this element)
|
String |
getAttributeById(int id)
Returns an HTMLElement's attribute by the attribute's ID (One of the ATTR_* constants)
|
String |
getAttributeName(Integer attrKey)
Returns the attribute name of the requested attribute
|
Vector |
getDescendantsByTagId(int tagId)
Returns all descendants with the specified tag id
|
Vector |
getDescendantsByTagId(int tagId,
int depth)
Returns all descendants with the specified tag id
|
HTMLElement |
getFirstChildByTagId(int tagId)
Returns an HTMLElement's child by a tag ID (One of the TAG_* constants)
|
String |
getSupportedAttributesList()
Returns a list of supported attributes for this tag.
|
int |
getTagId()
Returns this HTMLElement's ID
|
String |
getTagName()
Returns this HTMLElement's tag name
|
void |
removeAttributeById(int attrId)
Removes the specified attribute
|
void |
removeChildAt(int index)
{Removes the child at the given index}
|
int |
setAttribute(String attribute,
String value)
Adds the specified attribute and value to this Element if it is supported for the Element and has a valid value.
|
void |
setAttributeById(int attrId,
String value)
Allows setting an attribute with an attribute id
|
protected void |
setTagId(int tagId)
Sets this HTMLElement's ID
|
String |
toString()
{Returns a printable string representing this element}
|
String |
toString(String spacing)
A recursive method for creating a printout of a full tag with its entire hierarchy.
|
contains, getAttributeAsInt, getAttributes, getChildAt, getChildIndex, getChildren, getChildrenByTagName, getDescendantsByTagName, getDescendantsByTagName, getDescendantsByTagNameAndAttribute, getElementById, getFirstChildByTagName, getNumChildren, getParent, getText, getTextChildren, getTextDescendants, getTextDescendants, hasTextChild, insertChildAt, isEmpty, isTextElement, iterator, removeAttribute, removeAttribute, replaceChild, setAttribute, setChildren, setParent, setTagName, setText, setTextElement
public static final int TAG_CSS_ILLEGAL_SELECTOR
public static final int TAG_CSS_SELECTOR
public static final int TAG_UNSUPPORTED
public static final int TAG_BODY
public static final int TAG_HEAD
public static final int TAG_HTML
public static final int TAG_TITLE
public static final int TAG_ABBR
public static final int TAG_ACRONYM
public static final int TAG_ADDRESS
public static final int TAG_BLOCKQUOTE
public static final int TAG_BR
public static final int TAG_CITE
public static final int TAG_CODE
public static final int TAG_DFN
public static final int TAG_DIV
public static final int TAG_EM
public static final int TAG_H1
public static final int TAG_H2
public static final int TAG_H3
public static final int TAG_H4
public static final int TAG_H5
public static final int TAG_H6
public static final int TAG_KBD
public static final int TAG_P
public static final int TAG_PRE
public static final int TAG_Q
public static final int TAG_SAMP
public static final int TAG_SPAN
public static final int TAG_STRONG
public static final int TAG_VAR
public static final int TAG_A
public static final int TAG_DL
public static final int TAG_DT
public static final int TAG_DD
public static final int TAG_OL
public static final int TAG_UL
public static final int TAG_LI
public static final int TAG_FORM
public static final int TAG_INPUT
public static final int TAG_LABEL
public static final int TAG_SELECT
public static final int TAG_OPTION
public static final int TAG_TEXTAREA
public static final int TAG_CAPTION
public static final int TAG_TABLE
public static final int TAG_TD
public static final int TAG_TH
public static final int TAG_TR
public static final int TAG_IMG
public static final int TAG_OBJECT
public static final int TAG_PARAM
public static final int TAG_META
public static final int TAG_LINK
public static final int TAG_BASE
public static final int TAG_HR
public static final int TAG_OPTGROUP
public static final int TAG_STYLE
public static final int TAG_B
public static final int TAG_I
public static final int TAG_BIG
public static final int TAG_SMALL
public static final int TAG_FIELDSET
public static final int TAG_U
public static final int TAG_FONT
public static final int TAG_DEL
public static final int TAG_INS
public static final int TAG_TT
public static final int TAG_BASEFONT
public static final int TAG_MENU
public static final int TAG_S
public static final int TAG_STRIKE
public static final int TAG_CENTER
public static final int TAG_DIR
public static final int TAG_MAP
public static final int TAG_AREA
public static final int TAG_LEGEND
public static final int TAG_SUB
public static final int TAG_SUP
public static final int TAG_NOSCRIPT
public static final int TAG_NOFRAMES
public static final int TAG_THEAD
public static final int TAG_TBODY
public static final int TAG_TFOOT
public static final int TAG_BUTTON
public static final int TAG_TEXT
public static final int ATTR_CLASS
public static final int ATTR_ID
public static final int ATTR_STYLE
public static final int ATTR_TITLE
public static final int ATTR_XMLNS
public static final int ATTR_XMLLANG
public static final int ATTR_ALIGN
public static final int ATTR_BGCOLOR
public static final int ATTR_LINK
public static final int ATTR_TEXT
public static final int ATTR_VERSION
public static final int ATTR_CITE
public static final int ATTR_ACCESSKEY
public static final int ATTR_CHARSET
public static final int ATTR_HREF
public static final int ATTR_HREFLANG
public static final int ATTR_REL
public static final int ATTR_REV
public static final int ATTR_TABINDEX
public static final int ATTR_TYPE
public static final int ATTR_ACTION
public static final int ATTR_ENCTYPE
public static final int ATTR_METHOD
public static final int ATTR_WIDTH
public static final int ATTR_HEIGHT
public static final int ATTR_ALT
public static final int ATTR_HSPACE
public static final int ATTR_VSPACE
public static final int ATTR_LONGDESC
public static final int ATTR_LOCALSRC
public static final int ATTR_SRC
public static final int ATTR_SIZE
public static final int ATTR_CHECKED
public static final int ATTR_EMPTYOK
public static final int ATTR_FORMAT
public static final int ATTR_ISTYLE
public static final int ATTR_MAXLENGTH
public static final int ATTR_NAME
public static final int ATTR_VALUE
public static final int ATTR_FOR
public static final int ATTR_XMLSPACE
public static final int ATTR_MULTIPLE
public static final int ATTR_SELECTED
public static final int ATTR_ABBR
public static final int ATTR_AXIS
public static final int ATTR_COLSPAN
public static final int ATTR_HEADERS
public static final int ATTR_ROWSPAN
public static final int ATTR_SCOPE
public static final int ATTR_VALIGN
public static final int ATTR_START
public static final int ATTR_MEDIA
public static final int ATTR_LABEL
public static final int ATTR_SUMMARY
public static final int ATTR_CONTENT
public static final int ATTR_HTTPEQUIV
public static final int ATTR_SCHEME
public static final int ATTR_COLS
public static final int ATTR_ROWS
public static final int ATTR_DIR
public static final int ATTR_BORDER
public static final int ATTR_COLOR
public static final int ATTR_FACE
public static final int ATTR_SHAPE
public static final int ATTR_COORDS
public static final int ATTR_USEMAP
public static final int ATTR_LANG
public static final int ATTR_CELLSPACING
public static final int ATTR_CELLPADDING
public static final int ATTR_FRAME
public static final int ATTR_RULES
public static final int ATTR_DISABLED
public static final int ATTR_READONLY
public static final int ATTR_ISMAP
public static final int COLOR_AQUA
public static final int COLOR_BLACK
public static final int COLOR_BLUE
public static final int COLOR_FUCHSIA
public static final int COLOR_GRAY
public static final int COLOR_GREEN
public static final int COLOR_LIME
public static final int COLOR_MAROON
public static final int COLOR_NAVY
public static final int COLOR_OLIVE
public static final int COLOR_PURPLE
public static final int COLOR_RED
public static final int COLOR_SILVER
public static final int COLOR_TEAL
public static final int COLOR_WHITE
public static final int COLOR_YELLOW
public static final int COLOR_ORANGE
protected HTMLElement()
public HTMLElement(String tagName)
tagName
- The HTMLElement's namepublic HTMLElement(String tagName, boolean isTextElement)
tagName
- The HTMLElement's name, or the text for text elementsisTextElement
- true for a text element, false otherwisepublic void addChild(Element childElement)
Element
public int setAttribute(String attribute, String value)
setAttribute
in class Element
attribute
- The attribute's namevalue
- The attribute's valuepublic void setAttributeById(int attrId, String value)
attrId
- The attribute Id (One of the ATTR_ constants)value
- The value to set to the attributepublic void removeAttributeById(int attrId)
attrId
- The attribute Id (One of the ATTR_ constants)public String getSupportedAttributesList()
public String getTagName()
getTagName
in class Element
public int getTagId()
protected void setTagId(int tagId)
tagId
- The tag ID to set, one of the TAG_* constants (Not to be confused with the id attribute)public HTMLElement getFirstChildByTagId(int tagId)
tagId
- The child's tag ID, one of the TAG_* constants (Not to be confused with the id attribute)public String getAttributeById(int id)
id
- The attribute's IDpublic String toString()
public String getAttributeName(Integer attrKey)
attrKey
- The attribute key, which is typically an Integer object made of its int attrIdpublic String getAttribute(String name)
Element
getAttribute
in class Element
name
- The attribute idpublic String toString(String spacing)
public void removeChildAt(int index)
removeChildAt
in class Element
index
- The child's indexpublic Vector getDescendantsByTagId(int tagId, int depth)
tagId
- The tag ID to look for, one of the TAG_* constants (Not to be confused with the id attribute)depth
- The search depth (1 - children, 2 - grandchildren .... DEPTH_INFINITE - for all descendants)public Vector getDescendantsByTagId(int tagId)
tagId
- The tag ID to look for, one of the TAG_* constants (Not to be confused with the id attribute)