Class HTMLElement
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int///////////////////////////////static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int///////////////////////////////static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int///////////////////////////////static final intstatic final intstatic final intstatic final intstatic final int///////////////////////////////static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int///////////////////////////////static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intFields inherited from class Element
DEPTH_INFINITE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs and HTMLElement without specifying a name.HTMLElement(String tagName) Constructor for HTMLElement.HTMLElement(String tagName, boolean isTextElement) Constructor for HTMLElement. -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String name) Returns the attribute value by its name (or null if it wasn't defined for this element)getAttributeById(int id) Returns an HTMLElement's attribute by the attribute's ID (One of the ATTR_* constants)getAttributeName(Integer attrKey) Returns the attribute name of the requested attributegetDescendantsByTagId(int tagId) Returns all descendants with the specified tag idgetDescendantsByTagId(int tagId, int depth) Returns all descendants with the specified tag idgetFirstChildByTagId(int tagId) Returns an HTMLElement's child by a tag ID (One of the TAG_* constants)Returns a list of supported attributes for this tag.intgetTagId()Returns this HTMLElement's IDReturns this HTMLElement's tag namevoidremoveAttributeById(int attrId) Removes the specified attributevoidremoveChildAt(int index) {Removes the child at the given indexintsetAttribute(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.voidsetAttributeById(int attrId, String value) Allows setting an attribute with an attribute idprotected voidsetTagId(int tagId) Sets this HTMLElement's IDtoString(){Returns a printable string representing this elementA recursive method for creating a printout of a full tag with its entire hierarchy.Methods inherited from class Element
addChild, 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, setTextElementMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
TAG_CSS_ILLEGAL_SELECTOR
public static final int TAG_CSS_ILLEGAL_SELECTOR///////////////////////////////- See Also:
-
TAG_CSS_SELECTOR
public static final int TAG_CSS_SELECTOR- See Also:
-
TAG_UNSUPPORTED
public static final int TAG_UNSUPPORTED- See Also:
-
TAG_BODY
public static final int TAG_BODY- See Also:
-
TAG_HEAD
public static final int TAG_HEAD- See Also:
-
TAG_HTML
public static final int TAG_HTML- See Also:
-
TAG_TITLE
public static final int TAG_TITLE- See Also:
-
TAG_ABBR
public static final int TAG_ABBR- See Also:
-
TAG_ACRONYM
public static final int TAG_ACRONYM- See Also:
-
TAG_ADDRESS
public static final int TAG_ADDRESS- See Also:
-
TAG_BLOCKQUOTE
public static final int TAG_BLOCKQUOTE- See Also:
-
TAG_BR
public static final int TAG_BR- See Also:
-
TAG_CITE
public static final int TAG_CITE- See Also:
-
TAG_CODE
public static final int TAG_CODE- See Also:
-
TAG_DFN
public static final int TAG_DFN- See Also:
-
TAG_DIV
public static final int TAG_DIV- See Also:
-
TAG_EM
public static final int TAG_EM- See Also:
-
TAG_H1
public static final int TAG_H1- See Also:
-
TAG_H2
public static final int TAG_H2- See Also:
-
TAG_H3
public static final int TAG_H3- See Also:
-
TAG_H4
public static final int TAG_H4- See Also:
-
TAG_H5
public static final int TAG_H5- See Also:
-
TAG_H6
public static final int TAG_H6- See Also:
-
TAG_KBD
public static final int TAG_KBD- See Also:
-
TAG_P
public static final int TAG_P- See Also:
-
TAG_PRE
public static final int TAG_PRE- See Also:
-
TAG_Q
public static final int TAG_Q- See Also:
-
TAG_SAMP
public static final int TAG_SAMP- See Also:
-
TAG_SPAN
public static final int TAG_SPAN- See Also:
-
TAG_STRONG
public static final int TAG_STRONG- See Also:
-
TAG_VAR
public static final int TAG_VAR- See Also:
-
TAG_A
public static final int TAG_A- See Also:
-
TAG_DL
public static final int TAG_DL- See Also:
-
TAG_DT
public static final int TAG_DT- See Also:
-
TAG_DD
public static final int TAG_DD- See Also:
-
TAG_OL
public static final int TAG_OL- See Also:
-
TAG_UL
public static final int TAG_UL- See Also:
-
TAG_LI
public static final int TAG_LI- See Also:
-
TAG_FORM
public static final int TAG_FORM- See Also:
-
TAG_INPUT
public static final int TAG_INPUT- See Also:
-
TAG_LABEL
public static final int TAG_LABEL- See Also:
-
TAG_SELECT
public static final int TAG_SELECT- See Also:
-
TAG_OPTION
public static final int TAG_OPTION- See Also:
-
TAG_TEXTAREA
public static final int TAG_TEXTAREA- See Also:
-
TAG_CAPTION
public static final int TAG_CAPTION- See Also:
-
TAG_TABLE
public static final int TAG_TABLE- See Also:
-
TAG_TD
public static final int TAG_TD- See Also:
-
TAG_TH
public static final int TAG_TH- See Also:
-
TAG_TR
public static final int TAG_TR- See Also:
-
TAG_IMG
public static final int TAG_IMG- See Also:
-
TAG_OBJECT
public static final int TAG_OBJECT- See Also:
-
TAG_PARAM
public static final int TAG_PARAM- See Also:
-
TAG_META
public static final int TAG_META- See Also:
-
TAG_LINK
public static final int TAG_LINK- See Also:
-
TAG_BASE
public static final int TAG_BASE- See Also:
-
TAG_HR
public static final int TAG_HR- See Also:
-
TAG_OPTGROUP
public static final int TAG_OPTGROUP- See Also:
-
TAG_STYLE
public static final int TAG_STYLE- See Also:
-
TAG_B
public static final int TAG_B- See Also:
-
TAG_I
public static final int TAG_I- See Also:
-
TAG_BIG
public static final int TAG_BIG- See Also:
-
TAG_SMALL
public static final int TAG_SMALL- See Also:
-
TAG_FIELDSET
public static final int TAG_FIELDSET- See Also:
-
TAG_U
public static final int TAG_U- See Also:
-
TAG_FONT
public static final int TAG_FONT- See Also:
-
TAG_DEL
public static final int TAG_DEL- See Also:
-
TAG_INS
public static final int TAG_INS- See Also:
-
TAG_TT
public static final int TAG_TT- See Also:
-
TAG_BASEFONT
public static final int TAG_BASEFONT- See Also:
-
TAG_MENU
public static final int TAG_MENU- See Also:
-
TAG_S
public static final int TAG_S- See Also:
-
TAG_STRIKE
public static final int TAG_STRIKE- See Also:
-
TAG_CENTER
public static final int TAG_CENTER- See Also:
-
TAG_DIR
public static final int TAG_DIR- See Also:
-
TAG_MAP
public static final int TAG_MAP- See Also:
-
TAG_AREA
public static final int TAG_AREA- See Also:
-
TAG_LEGEND
public static final int TAG_LEGEND- See Also:
-
TAG_SUB
public static final int TAG_SUB- See Also:
-
TAG_SUP
public static final int TAG_SUP- See Also:
-
TAG_NOSCRIPT
public static final int TAG_NOSCRIPT- See Also:
-
TAG_NOFRAMES
public static final int TAG_NOFRAMES- See Also:
-
TAG_THEAD
public static final int TAG_THEAD- See Also:
-
TAG_TBODY
public static final int TAG_TBODY- See Also:
-
TAG_TFOOT
public static final int TAG_TFOOT- See Also:
-
TAG_BUTTON
public static final int TAG_BUTTON- See Also:
-
TAG_TEXT
public static final int TAG_TEXT- See Also:
-
ATTR_CLASS
public static final int ATTR_CLASS///////////////////////////////- See Also:
-
ATTR_ID
public static final int ATTR_ID- See Also:
-
ATTR_STYLE
public static final int ATTR_STYLE///////////////////////////////- See Also:
-
ATTR_TITLE
public static final int ATTR_TITLE- See Also:
-
ATTR_XMLNS
public static final int ATTR_XMLNS- See Also:
-
ATTR_XMLLANG
public static final int ATTR_XMLLANG- See Also:
-
ATTR_ALIGN
public static final int ATTR_ALIGN- See Also:
-
ATTR_BGCOLOR
public static final int ATTR_BGCOLOR- See Also:
-
ATTR_LINK
public static final int ATTR_LINK- See Also:
-
ATTR_TEXT
public static final int ATTR_TEXT- See Also:
-
ATTR_VERSION
public static final int ATTR_VERSION- See Also:
-
ATTR_CITE
public static final int ATTR_CITE- See Also:
-
ATTR_ACCESSKEY
public static final int ATTR_ACCESSKEY- See Also:
-
ATTR_CHARSET
public static final int ATTR_CHARSET- See Also:
-
ATTR_HREF
public static final int ATTR_HREF- See Also:
-
ATTR_HREFLANG
public static final int ATTR_HREFLANG- See Also:
-
ATTR_REL
public static final int ATTR_REL- See Also:
-
ATTR_REV
public static final int ATTR_REV- See Also:
-
ATTR_TABINDEX
public static final int ATTR_TABINDEX- See Also:
-
ATTR_TYPE
public static final int ATTR_TYPE- See Also:
-
ATTR_ACTION
public static final int ATTR_ACTION- See Also:
-
ATTR_ENCTYPE
public static final int ATTR_ENCTYPE- See Also:
-
ATTR_METHOD
public static final int ATTR_METHOD- See Also:
-
ATTR_WIDTH
public static final int ATTR_WIDTH- See Also:
-
ATTR_HEIGHT
public static final int ATTR_HEIGHT- See Also:
-
ATTR_ALT
public static final int ATTR_ALT- See Also:
-
ATTR_HSPACE
public static final int ATTR_HSPACE- See Also:
-
ATTR_VSPACE
public static final int ATTR_VSPACE- See Also:
-
ATTR_LONGDESC
public static final int ATTR_LONGDESC- See Also:
-
ATTR_LOCALSRC
public static final int ATTR_LOCALSRC- See Also:
-
ATTR_SRC
public static final int ATTR_SRC- See Also:
-
ATTR_SIZE
public static final int ATTR_SIZE- See Also:
-
ATTR_CHECKED
public static final int ATTR_CHECKED- See Also:
-
ATTR_EMPTYOK
public static final int ATTR_EMPTYOK- See Also:
-
ATTR_FORMAT
public static final int ATTR_FORMAT- See Also:
-
ATTR_ISTYLE
public static final int ATTR_ISTYLE- See Also:
-
ATTR_MAXLENGTH
public static final int ATTR_MAXLENGTH- See Also:
-
ATTR_NAME
public static final int ATTR_NAME- See Also:
-
ATTR_VALUE
public static final int ATTR_VALUE- See Also:
-
ATTR_FOR
public static final int ATTR_FOR- See Also:
-
ATTR_XMLSPACE
public static final int ATTR_XMLSPACE- See Also:
-
ATTR_MULTIPLE
public static final int ATTR_MULTIPLE- See Also:
-
ATTR_SELECTED
public static final int ATTR_SELECTED- See Also:
-
ATTR_ABBR
public static final int ATTR_ABBR- See Also:
-
ATTR_AXIS
public static final int ATTR_AXIS- See Also:
-
ATTR_COLSPAN
public static final int ATTR_COLSPAN- See Also:
-
ATTR_HEADERS
public static final int ATTR_HEADERS- See Also:
-
ATTR_ROWSPAN
public static final int ATTR_ROWSPAN- See Also:
-
ATTR_SCOPE
public static final int ATTR_SCOPE- See Also:
-
ATTR_VALIGN
public static final int ATTR_VALIGN- See Also:
-
ATTR_START
public static final int ATTR_START- See Also:
-
ATTR_MEDIA
public static final int ATTR_MEDIA- See Also:
-
ATTR_LABEL
public static final int ATTR_LABEL- See Also:
-
ATTR_SUMMARY
public static final int ATTR_SUMMARY- See Also:
-
ATTR_CONTENT
public static final int ATTR_CONTENT- See Also:
-
ATTR_HTTPEQUIV
public static final int ATTR_HTTPEQUIV- See Also:
-
ATTR_SCHEME
public static final int ATTR_SCHEME- See Also:
-
ATTR_COLS
public static final int ATTR_COLS- See Also:
-
ATTR_ROWS
public static final int ATTR_ROWS- See Also:
-
ATTR_DIR
public static final int ATTR_DIR- See Also:
-
ATTR_BORDER
public static final int ATTR_BORDER- See Also:
-
ATTR_COLOR
public static final int ATTR_COLOR- See Also:
-
ATTR_FACE
public static final int ATTR_FACE- See Also:
-
ATTR_SHAPE
public static final int ATTR_SHAPE- See Also:
-
ATTR_COORDS
public static final int ATTR_COORDS- See Also:
-
ATTR_USEMAP
public static final int ATTR_USEMAP- See Also:
-
ATTR_LANG
public static final int ATTR_LANG- See Also:
-
ATTR_CELLSPACING
public static final int ATTR_CELLSPACING- See Also:
-
ATTR_CELLPADDING
public static final int ATTR_CELLPADDING- See Also:
-
ATTR_FRAME
public static final int ATTR_FRAME- See Also:
-
ATTR_RULES
public static final int ATTR_RULES- See Also:
-
ATTR_DISABLED
public static final int ATTR_DISABLED- See Also:
-
ATTR_READONLY
public static final int ATTR_READONLY- See Also:
-
ATTR_ISMAP
public static final int ATTR_ISMAP- See Also:
-
COLOR_AQUA
public static final int COLOR_AQUA///////////////////////////////- See Also:
-
COLOR_BLACK
public static final int COLOR_BLACK- See Also:
-
COLOR_BLUE
public static final int COLOR_BLUE- See Also:
-
COLOR_FUCHSIA
public static final int COLOR_FUCHSIA- See Also:
-
COLOR_GRAY
public static final int COLOR_GRAY- See Also:
-
COLOR_GREEN
public static final int COLOR_GREEN///////////////////////////////- See Also:
-
COLOR_LIME
public static final int COLOR_LIME- See Also:
-
COLOR_MAROON
public static final int COLOR_MAROON- See Also:
-
COLOR_NAVY
public static final int COLOR_NAVY- See Also:
-
COLOR_OLIVE
public static final int COLOR_OLIVE- See Also:
-
COLOR_PURPLE
public static final int COLOR_PURPLE- See Also:
-
COLOR_RED
public static final int COLOR_RED- See Also:
-
COLOR_SILVER
public static final int COLOR_SILVER- See Also:
-
COLOR_TEAL
public static final int COLOR_TEAL- See Also:
-
COLOR_WHITE
public static final int COLOR_WHITE- See Also:
-
COLOR_YELLOW
public static final int COLOR_YELLOW- See Also:
-
COLOR_ORANGE
public static final int COLOR_ORANGE- See Also:
-
-
Constructor Details
-
HTMLElement
protected HTMLElement()Constructs and HTMLElement without specifying a name. This can be used by subclasses that do not require name assigments. -
HTMLElement
Constructor for HTMLElement. This mostly sets up the element's ID.
Parameters
tagName: The HTMLElement's name
-
HTMLElement
Constructor for HTMLElement. This mostly sets up the element's ID.
Parameters
-
tagName: The HTMLElement's name, or the text for text elements -
isTextElement: true for a text element, false otherwise
-
-
-
Method Details
-
setAttribute
Adds the specified attribute and value to this Element if it is supported for the Element and has a valid value.
Parameters
-
attribute: The attribute's name -
value: The attribute's value
Returns
a positive error code or -1 if attribute is supported and valid
- Overrides:
setAttributein classElement
-
-
setAttributeById
Allows setting an attribute with an attribute id
Parameters
-
attrId: The attribute Id (One of the ATTR_ constants) -
value: The value to set to the attribute
-
-
removeAttributeById
public void removeAttributeById(int attrId) Removes the specified attribute
Parameters
attrId: The attribute Id (One of the ATTR_ constants)
-
getSupportedAttributesList
Returns a list of supported attributes for this tag. Note that the list does not include the core attributes that are supported on almost all tags
Returns
a list of supported attributes for this tag
-
getTagName
Returns this HTMLElement's tag name
Returns
the HTMLElement's tag name
- Overrides:
getTagNamein classElement
-
getTagId
public int getTagId()Returns this HTMLElement's ID
Returns
the HTMLELement's ID
-
setTagId
protected void setTagId(int tagId) Sets this HTMLElement's ID
Parameters
tagId: The tag ID to set, one of the TAG_* constants (Not to be confused with the id attribute)
-
getFirstChildByTagId
Returns an HTMLElement's child by a tag ID (One of the TAG_* constants)
Parameters
tagId: The child's tag ID, one of the TAG_* constants (Not to be confused with the id attribute)
Returns
the first child with the specified ID, or null if not found
-
getAttributeById
Returns an HTMLElement's attribute by the attribute's ID (One of the ATTR_* constants)
Parameters
id: The attribute's ID
Returns
the attribute with the specified ID, or null if not found
-
toString
-
getAttributeName
-
getAttribute
Description copied from class:ElementReturns the attribute value by its name (or null if it wasn't defined for this element)
Parameters
name: The attribute id
Returns
the attribute value by its name (or null if it wasn't defined for this element)
- Overrides:
getAttributein classElement
-
toString
A recursive method for creating a printout of a full tag with its entire hierarchy. This is used by the public method toString().
Parameters
spacing: Increased by one in each recursion phase to provide with indentation
Returns
the printout of this tag
-
removeChildAt
public void removeChildAt(int index) {
Removes the child at the given index
Parameters
index: The child's index
- Overrides:
removeChildAtin classElement
-
getDescendantsByTagId
Returns all descendants with the specified tag id
Parameters
-
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)
Returns
A vector containing descendants with the specified tag id
-
-
getDescendantsByTagId
Returns all descendants with the specified tag id
Parameters
tagId: The tag ID to look for, one of the TAG_* constants (Not to be confused with the id attribute)
Returns
A vector containing descendants with the specified tag id
-