# Class HTMLElement

java.lang.Object
com.codename1.xml.Element
com.codename1.ui.html.HTMLElement

All Implemented Interfaces:
  `Iterable<Element>`

public class HTMLElement extends Element
The HTMLElement class defines a single HTML element with its attributes and children. Due to its hierarchial nature, this class can be used for a single "leaf" Element, for more complex elements (with child elements), and up to describing the entire document.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `ATTR_ABBR`
  `static final int`
  `ATTR_ACCESSKEY`
  `static final int`
  `ATTR_ACTION`
  `static final int`
  `ATTR_ALIGN`
  `static final int`
  `ATTR_ALT`
  `static final int`
  `ATTR_AXIS`
  `static final int`
  `ATTR_BGCOLOR`
  `static final int`
  `ATTR_BORDER`
  `static final int`
  `ATTR_CELLPADDING`
  `static final int`
  `ATTR_CELLSPACING`
  `static final int`
  `ATTR_CHARSET`
  `static final int`
  `ATTR_CHECKED`
  `static final int`
  `ATTR_CITE`
  `static final int`
  `ATTR_CLASS`
  ///////////////////////////////
  `static final int`
  `ATTR_COLOR`
  `static final int`
  `ATTR_COLS`
  `static final int`
  `ATTR_COLSPAN`
  `static final int`
  `ATTR_CONTENT`
  `static final int`
  `ATTR_COORDS`
  `static final int`
  `ATTR_DIR`
  `static final int`
  `ATTR_DISABLED`
  `static final int`
  `ATTR_EMPTYOK`
  `static final int`
  `ATTR_ENCTYPE`
  `static final int`
  `ATTR_FACE`
  `static final int`
  `ATTR_FOR`
  `static final int`
  `ATTR_FORMAT`
  `static final int`
  `ATTR_FRAME`
  `static final int`
  `ATTR_HEADERS`
  `static final int`
  `ATTR_HEIGHT`
  `static final int`
  `ATTR_HREF`
  `static final int`
  `ATTR_HREFLANG`
  `static final int`
  `ATTR_HSPACE`
  `static final int`
  `ATTR_HTTPEQUIV`
  `static final int`
  `ATTR_ID`
  `static final int`
  `ATTR_ISMAP`
  `static final int`
  `ATTR_ISTYLE`
  `static final int`
  `ATTR_LABEL`
  `static final int`
  `ATTR_LANG`
  `static final int`
  `ATTR_LINK`
  `static final int`
  `ATTR_LOCALSRC`
  `static final int`
  `ATTR_LONGDESC`
  `static final int`
  `ATTR_MAXLENGTH`
  `static final int`
  `ATTR_MEDIA`
  `static final int`
  `ATTR_METHOD`
  `static final int`
  `ATTR_MULTIPLE`
  `static final int`
  `ATTR_NAME`
  `static final int`
  `ATTR_READONLY`
  `static final int`
  `ATTR_REL`
  `static final int`
  `ATTR_REV`
  `static final int`
  `ATTR_ROWS`
  `static final int`
  `ATTR_ROWSPAN`
  `static final int`
  `ATTR_RULES`
  `static final int`
  `ATTR_SCHEME`
  `static final int`
  `ATTR_SCOPE`
  `static final int`
  `ATTR_SELECTED`
  `static final int`
  `ATTR_SHAPE`
  `static final int`
  `ATTR_SIZE`
  `static final int`
  `ATTR_SRC`
  `static final int`
  `ATTR_START`
  `static final int`
  `ATTR_STYLE`
  ///////////////////////////////
  `static final int`
  `ATTR_SUMMARY`
  `static final int`
  `ATTR_TABINDEX`
  `static final int`
  `ATTR_TEXT`
  `static final int`
  `ATTR_TITLE`
  `static final int`
  `ATTR_TYPE`
  `static final int`
  `ATTR_USEMAP`
  `static final int`
  `ATTR_VALIGN`
  `static final int`
  `ATTR_VALUE`
  `static final int`
  `ATTR_VERSION`
  `static final int`
  `ATTR_VSPACE`
  `static final int`
  `ATTR_WIDTH`
  `static final int`
  `ATTR_XMLLANG`
  `static final int`
  `ATTR_XMLNS`
  `static final int`
  `ATTR_XMLSPACE`
  `static final int`
  `COLOR_AQUA`
  ///////////////////////////////
  `static final int`
  `COLOR_BLACK`
  `static final int`
  `COLOR_BLUE`
  `static final int`
  `COLOR_FUCHSIA`
  `static final int`
  `COLOR_GRAY`
  `static final int`
  `COLOR_GREEN`
  ///////////////////////////////
  `static final int`
  `COLOR_LIME`
  `static final int`
  `COLOR_MAROON`
  `static final int`
  `COLOR_NAVY`
  `static final int`
  `COLOR_OLIVE`
  `static final int`
  `COLOR_ORANGE`
  `static final int`
  `COLOR_PURPLE`
  `static final int`
  `COLOR_RED`
  `static final int`
  `COLOR_SILVER`
  `static final int`
  `COLOR_TEAL`
  `static final int`
  `COLOR_WHITE`
  `static final int`
  `COLOR_YELLOW`
  `static final int`
  `TAG_A`
  `static final int`
  `TAG_ABBR`
  `static final int`
  `TAG_ACRONYM`
  `static final int`
  `TAG_ADDRESS`
  `static final int`
  `TAG_AREA`
  `static final int`
  `TAG_B`
  `static final int`
  `TAG_BASE`
  `static final int`
  `TAG_BASEFONT`
  `static final int`
  `TAG_BIG`
  `static final int`
  `TAG_BLOCKQUOTE`
  `static final int`
  `TAG_BODY`
  `static final int`
  `TAG_BR`
  `static final int`
  `TAG_BUTTON`
  `static final int`
  `TAG_CAPTION`
  `static final int`
  `TAG_CENTER`
  `static final int`
  `TAG_CITE`
  `static final int`
  `TAG_CODE`
  `static final int`
  `TAG_CSS_ILLEGAL_SELECTOR`
  ///////////////////////////////
  `static final int`
  `TAG_CSS_SELECTOR`
  `static final int`
  `TAG_DD`
  `static final int`
  `TAG_DEL`
  `static final int`
  `TAG_DFN`
  `static final int`
  `TAG_DIR`
  `static final int`
  `TAG_DIV`
  `static final int`
  `TAG_DL`
  `static final int`
  `TAG_DT`
  `static final int`
  `TAG_EM`
  `static final int`
  `TAG_FIELDSET`
  `static final int`
  `TAG_FONT`
  `static final int`
  `TAG_FORM`
  `static final int`
  `TAG_H1`
  `static final int`
  `TAG_H2`
  `static final int`
  `TAG_H3`
  `static final int`
  `TAG_H4`
  `static final int`
  `TAG_H5`
  `static final int`
  `TAG_H6`
  `static final int`
  `TAG_HEAD`
  `static final int`
  `TAG_HR`
  `static final int`
  `TAG_HTML`
  `static final int`
  `TAG_I`
  `static final int`
  `TAG_IMG`
  `static final int`
  `TAG_INPUT`
  `static final int`
  `TAG_INS`
  `static final int`
  `TAG_KBD`
  `static final int`
  `TAG_LABEL`
  `static final int`
  `TAG_LEGEND`
  `static final int`
  `TAG_LI`
  `static final int`
  `TAG_LINK`
  `static final int`
  `TAG_MAP`
  `static final int`
  `TAG_MENU`
  `static final int`
  `TAG_META`
  `static final int`
  `TAG_NOFRAMES`
  `static final int`
  `TAG_NOSCRIPT`
  `static final int`
  `TAG_OBJECT`
  `static final int`
  `TAG_OL`
  `static final int`
  `TAG_OPTGROUP`
  `static final int`
  `TAG_OPTION`
  `static final int`
  `TAG_P`
  `static final int`
  `TAG_PARAM`
  `static final int`
  `TAG_PRE`
  `static final int`
  `TAG_Q`
  `static final int`
  `TAG_S`
  `static final int`
  `TAG_SAMP`
  `static final int`
  `TAG_SELECT`
  `static final int`
  `TAG_SMALL`
  `static final int`
  `TAG_SPAN`
  `static final int`
  `TAG_STRIKE`
  `static final int`
  `TAG_STRONG`
  `static final int`
  `TAG_STYLE`
  `static final int`
  `TAG_SUB`
  `static final int`
  `TAG_SUP`
  `static final int`
  `TAG_TABLE`
  `static final int`
  `TAG_TBODY`
  `static final int`
  `TAG_TD`
  `static final int`
  `TAG_TEXT`
  `static final int`
  `TAG_TEXTAREA`
  `static final int`
  `TAG_TFOOT`
  `static final int`
  `TAG_TH`
  `static final int`
  `TAG_THEAD`
  `static final int`
  `TAG_TITLE`
  `static final int`
  `TAG_TR`
  `static final int`
  `TAG_TT`
  `static final int`
  `TAG_U`
  `static final int`
  `TAG_UL`
  `static final int`
  `TAG_UNSUPPORTED`
  `static final int`
  `TAG_VAR`

  ### Fields inherited from class Element

  `DEPTH_INFINITE`
  Modifier and Type
  Field
  Description
  `static final int`
  `DEPTH_INFINITE`
  A constant that can be used for the get descendants methods to denote infinite recursion

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `HTMLElement()`
  Constructs and HTMLElement without specifying a name.
  ``
  `HTMLElement(String tagName)`
  Constructor for HTMLElement.
  ``
  `HTMLElement(String tagName, boolean isTextElement)`
  Constructor for HTMLElement.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `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.

  ### 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, setTextElement`
  Modifier and Type
  Method
  Description
  `void`
  `addChild(Element childElement)`
  Adds the specified Element as a child to this element.
  `boolean`
  `contains(Element element)`
  Returns true if the specified element is contained in this element's hierarchy (meaning it is one of its descendants)
  `int`
  `getAttributeAsInt(String name, int def)`
  Helper method to return the attribute as an integer
  `Hashtable`
  `getAttributes()`
  Returns the attributes Hashtable
  `Element`
  `getChildAt(int index)`
  Returns the Element's child positioned at the specified index
  `int`
  `getChildIndex(Element child)`
  Returns the child index
  `protected Vector`
  `getChildren()`
  Returns the internal children vector
  `Vector`
  `getChildrenByTagName(String name)`
  Returns all children with the specified tag name
  `Vector`
  `getDescendantsByTagName(String name)`
  Returns all descendants with the specified tag name
  `Vector`
  `getDescendantsByTagName(String name, int depth)`
  Returns all descendants with the specified tag name
  `Vector`
  `getDescendantsByTagNameAndAttribute(String name, String attributeName, int depth)`
  Returns all descendants with the specified tag name and the none empty attribute
  `Element`
  `getElementById(String id)`
  Returns the element with the specified ID
  `Element`
  `getFirstChildByTagName(String name)`
  Returns an Element's child by a tag name
  `int`
  `getNumChildren()`
  Returns the number of this Element's children
  `Element`
  `getParent()`
  Returns this Element's parent
  `String`
  `getText()`
  Returns the text of this element (for text elements only)
  `Vector`
  `getTextChildren(String text, boolean caseSensitive)`
  Returns all children with the specified text
  `Vector`
  `getTextDescendants(String text, boolean caseSensitive)`
  Returns all text descendants containing the specified text
  `Vector`
  `getTextDescendants(String text, boolean caseSensitive, int depth)`
  Returns all text descendants containing the specified text
  `boolean`
  `hasTextChild()`
  Determines whether or not this Element has any text children.
  `void`
  `insertChildAt(Element child, int index)`
  Inserts the given child at the specified index
  `boolean`
  `isEmpty()`
  Determines whether or not this Element has no children.
  `boolean`
  `isTextElement()`
  Returns true if this is a text element, false otherwise
  `Iterator<Element>`
  `iterator()`
  Iterable for children of this entry making tree walking easier, this makes for(Element child : base) {} possible
  `protected void`
  `removeAttribute(Object id)`
  Removes the specified attribute if it exist in this Element This method allows creating a key that is non-string to be used by subclasses that optimize attributes retrieval
  `void`
  `removeAttribute(String attribute)`
  Removes the specified attribute
  `void`
  `replaceChild(Element oldChild, Element newChild)`
  Replaces one child with another
  `protected void`
  `setAttribute(Object id, String value)`
  Adds the specified attribute and value to this Element if it is supported for the Element and has a valid value.
  `protected void`
  `setChildren(Vector children)`
  Sets the children vector of this Element
  `protected void`
  `setParent(Element parent)`
  Sets this element parent, done interanlly in addChild
  `protected void`
  `setTagName(String name)`
  Sets the name or text (for text elements) of this tag
  `void`
  `setText(String str)`
  Sets the text of this element to the specified string (For text elements only)
  `protected void`
  `setTextElement(boolean textElement)`
  Sets this element as a text element

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  `boolean`
  `equals(Object obj)`
  Indicates whether some other object is "equal to" this one.
  `final Class`
  `getClass()`
  Returns the runtime class of an object.
  `int`
  `hashCode()`
  Returns a hash code value for the object.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `final void`
  `wait()`
  Causes current thread to wait until another thread invokes the method or the method for this object.
  `final void`
  `wait(long timeout)`
  Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
  `final void`
  `wait(long timeout, int nanos)`
  Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.

- ## Field Details

  - ### TAG_CSS_ILLEGAL_SELECTOR

    public static final int TAG_CSS_ILLEGAL_SELECTOR
    ///////////////////////////////
    See Also:
      - Constant Field Values

  - ### TAG_CSS_SELECTOR

    public static final int TAG_CSS_SELECTOR
    See Also:
      - Constant Field Values

  - ### TAG_UNSUPPORTED

    public static final int TAG_UNSUPPORTED
    See Also:
      - Constant Field Values

  - ### TAG_BODY

    public static final int TAG_BODY
    See Also:
      - Constant Field Values

  - ### TAG_HEAD

    public static final int TAG_HEAD
    See Also:
      - Constant Field Values

  - ### TAG_HTML

    public static final int TAG_HTML
    See Also:
      - Constant Field Values

  - ### TAG_TITLE

    public static final int TAG_TITLE
    See Also:
      - Constant Field Values

  - ### TAG_ABBR

    public static final int TAG_ABBR
    See Also:
      - Constant Field Values

  - ### TAG_ACRONYM

    public static final int TAG_ACRONYM
    See Also:
      - Constant Field Values

  - ### TAG_ADDRESS

    public static final int TAG_ADDRESS
    See Also:
      - Constant Field Values

  - ### TAG_BLOCKQUOTE

    public static final int TAG_BLOCKQUOTE
    See Also:
      - Constant Field Values

  - ### TAG_BR

    public static final int TAG_BR
    See Also:
      - Constant Field Values

  - ### TAG_CITE

    public static final int TAG_CITE
    See Also:
      - Constant Field Values

  - ### TAG_CODE

    public static final int TAG_CODE
    See Also:
      - Constant Field Values

  - ### TAG_DFN

    public static final int TAG_DFN
    See Also:
      - Constant Field Values

  - ### TAG_DIV

    public static final int TAG_DIV
    See Also:
      - Constant Field Values

  - ### TAG_EM

    public static final int TAG_EM
    See Also:
      - Constant Field Values

  - ### TAG_H1

    public static final int TAG_H1
    See Also:
      - Constant Field Values

  - ### TAG_H2

    public static final int TAG_H2
    See Also:
      - Constant Field Values

  - ### TAG_H3

    public static final int TAG_H3
    See Also:
      - Constant Field Values

  - ### TAG_H4

    public static final int TAG_H4
    See Also:
      - Constant Field Values

  - ### TAG_H5

    public static final int TAG_H5
    See Also:
      - Constant Field Values

  - ### TAG_H6

    public static final int TAG_H6
    See Also:
      - Constant Field Values

  - ### TAG_KBD

    public static final int TAG_KBD
    See Also:
      - Constant Field Values

  - ### TAG_P

    public static final int TAG_P
    See Also:
      - Constant Field Values

  - ### TAG_PRE

    public static final int TAG_PRE
    See Also:
      - Constant Field Values

  - ### TAG_Q

    public static final int TAG_Q
    See Also:
      - Constant Field Values

  - ### TAG_SAMP

    public static final int TAG_SAMP
    See Also:
      - Constant Field Values

  - ### TAG_SPAN

    public static final int TAG_SPAN
    See Also:
      - Constant Field Values

  - ### TAG_STRONG

    public static final int TAG_STRONG
    See Also:
      - Constant Field Values

  - ### TAG_VAR

    public static final int TAG_VAR
    See Also:
      - Constant Field Values

  - ### TAG_A

    public static final int TAG_A
    See Also:
      - Constant Field Values

  - ### TAG_DL

    public static final int TAG_DL
    See Also:
      - Constant Field Values

  - ### TAG_DT

    public static final int TAG_DT
    See Also:
      - Constant Field Values

  - ### TAG_DD

    public static final int TAG_DD
    See Also:
      - Constant Field Values

  - ### TAG_OL

    public static final int TAG_OL
    See Also:
      - Constant Field Values

  - ### TAG_UL

    public static final int TAG_UL
    See Also:
      - Constant Field Values

  - ### TAG_LI

    public static final int TAG_LI
    See Also:
      - Constant Field Values

  - ### TAG_FORM

    public static final int TAG_FORM
    See Also:
      - Constant Field Values

  - ### TAG_INPUT

    public static final int TAG_INPUT
    See Also:
      - Constant Field Values

  - ### TAG_LABEL

    public static final int TAG_LABEL
    See Also:
      - Constant Field Values

  - ### TAG_SELECT

    public static final int TAG_SELECT
    See Also:
      - Constant Field Values

  - ### TAG_OPTION

    public static final int TAG_OPTION
    See Also:
      - Constant Field Values

  - ### TAG_TEXTAREA

    public static final int TAG_TEXTAREA
    See Also:
      - Constant Field Values

  - ### TAG_CAPTION

    public static final int TAG_CAPTION
    See Also:
      - Constant Field Values

  - ### TAG_TABLE

    public static final int TAG_TABLE
    See Also:
      - Constant Field Values

  - ### TAG_TD

    public static final int TAG_TD
    See Also:
      - Constant Field Values

  - ### TAG_TH

    public static final int TAG_TH
    See Also:
      - Constant Field Values

  - ### TAG_TR

    public static final int TAG_TR
    See Also:
      - Constant Field Values

  - ### TAG_IMG

    public static final int TAG_IMG
    See Also:
      - Constant Field Values

  - ### TAG_OBJECT

    public static final int TAG_OBJECT
    See Also:
      - Constant Field Values

  - ### TAG_PARAM

    public static final int TAG_PARAM
    See Also:
      - Constant Field Values

  - ### TAG_META

    public static final int TAG_META
    See Also:
      - Constant Field Values

  - ### TAG_LINK

    public static final int TAG_LINK
    See Also:
      - Constant Field Values

  - ### TAG_BASE

    public static final int TAG_BASE
    See Also:
      - Constant Field Values

  - ### TAG_HR

    public static final int TAG_HR
    See Also:
      - Constant Field Values

  - ### TAG_OPTGROUP

    public static final int TAG_OPTGROUP
    See Also:
      - Constant Field Values

  - ### TAG_STYLE

    public static final int TAG_STYLE
    See Also:
      - Constant Field Values

  - ### TAG_B

    public static final int TAG_B
    See Also:
      - Constant Field Values

  - ### TAG_I

    public static final int TAG_I
    See Also:
      - Constant Field Values

  - ### TAG_BIG

    public static final int TAG_BIG
    See Also:
      - Constant Field Values

  - ### TAG_SMALL

    public static final int TAG_SMALL
    See Also:
      - Constant Field Values

  - ### TAG_FIELDSET

    public static final int TAG_FIELDSET
    See Also:
      - Constant Field Values

  - ### TAG_U

    public static final int TAG_U
    See Also:
      - Constant Field Values

  - ### TAG_FONT

    public static final int TAG_FONT
    See Also:
      - Constant Field Values

  - ### TAG_DEL

    public static final int TAG_DEL
    See Also:
      - Constant Field Values

  - ### TAG_INS

    public static final int TAG_INS
    See Also:
      - Constant Field Values

  - ### TAG_TT

    public static final int TAG_TT
    See Also:
      - Constant Field Values

  - ### TAG_BASEFONT

    public static final int TAG_BASEFONT
    See Also:
      - Constant Field Values

  - ### TAG_MENU

    public static final int TAG_MENU
    See Also:
      - Constant Field Values

  - ### TAG_S

    public static final int TAG_S
    See Also:
      - Constant Field Values

  - ### TAG_STRIKE

    public static final int TAG_STRIKE
    See Also:
      - Constant Field Values

  - ### TAG_CENTER

    public static final int TAG_CENTER
    See Also:
      - Constant Field Values

  - ### TAG_DIR

    public static final int TAG_DIR
    See Also:
      - Constant Field Values

  - ### TAG_MAP

    public static final int TAG_MAP
    See Also:
      - Constant Field Values

  - ### TAG_AREA

    public static final int TAG_AREA
    See Also:
      - Constant Field Values

  - ### TAG_LEGEND

    public static final int TAG_LEGEND
    See Also:
      - Constant Field Values

  - ### TAG_SUB

    public static final int TAG_SUB
    See Also:
      - Constant Field Values

  - ### TAG_SUP

    public static final int TAG_SUP
    See Also:
      - Constant Field Values

  - ### TAG_NOSCRIPT

    public static final int TAG_NOSCRIPT
    See Also:
      - Constant Field Values

  - ### TAG_NOFRAMES

    public static final int TAG_NOFRAMES
    See Also:
      - Constant Field Values

  - ### TAG_THEAD

    public static final int TAG_THEAD
    See Also:
      - Constant Field Values

  - ### TAG_TBODY

    public static final int TAG_TBODY
    See Also:
      - Constant Field Values

  - ### TAG_TFOOT

    public static final int TAG_TFOOT
    See Also:
      - Constant Field Values

  - ### TAG_BUTTON

    public static final int TAG_BUTTON
    See Also:
      - Constant Field Values

  - ### TAG_TEXT

    public static final int TAG_TEXT
    See Also:
      - Constant Field Values

  - ### ATTR_CLASS

    public static final int ATTR_CLASS
    ///////////////////////////////
    See Also:
      - Constant Field Values

  - ### ATTR_ID

    public static final int ATTR_ID
    See Also:
      - Constant Field Values

  - ### ATTR_STYLE

    public static final int ATTR_STYLE
    ///////////////////////////////
    See Also:
      - Constant Field Values

  - ### ATTR_TITLE

    public static final int ATTR_TITLE
    See Also:
      - Constant Field Values

  - ### ATTR_XMLNS

    public static final int ATTR_XMLNS
    See Also:
      - Constant Field Values

  - ### ATTR_XMLLANG

    public static final int ATTR_XMLLANG
    See Also:
      - Constant Field Values

  - ### ATTR_ALIGN

    public static final int ATTR_ALIGN
    See Also:
      - Constant Field Values

  - ### ATTR_BGCOLOR

    public static final int ATTR_BGCOLOR
    See Also:
      - Constant Field Values

  - ### ATTR_LINK

    public static final int ATTR_LINK
    See Also:
      - Constant Field Values

  - ### ATTR_TEXT

    public static final int ATTR_TEXT
    See Also:
      - Constant Field Values

  - ### ATTR_VERSION

    public static final int ATTR_VERSION
    See Also:
      - Constant Field Values

  - ### ATTR_CITE

    public static final int ATTR_CITE
    See Also:
      - Constant Field Values

  - ### ATTR_ACCESSKEY

    public static final int ATTR_ACCESSKEY
    See Also:
      - Constant Field Values

  - ### ATTR_CHARSET

    public static final int ATTR_CHARSET
    See Also:
      - Constant Field Values

  - ### ATTR_HREF

    public static final int ATTR_HREF
    See Also:
      - Constant Field Values

  - ### ATTR_HREFLANG

    public static final int ATTR_HREFLANG
    See Also:
      - Constant Field Values

  - ### ATTR_REL

    public static final int ATTR_REL
    See Also:
      - Constant Field Values

  - ### ATTR_REV

    public static final int ATTR_REV
    See Also:
      - Constant Field Values

  - ### ATTR_TABINDEX

    public static final int ATTR_TABINDEX
    See Also:
      - Constant Field Values

  - ### ATTR_TYPE

    public static final int ATTR_TYPE
    See Also:
      - Constant Field Values

  - ### ATTR_ACTION

    public static final int ATTR_ACTION
    See Also:
      - Constant Field Values

  - ### ATTR_ENCTYPE

    public static final int ATTR_ENCTYPE
    See Also:
      - Constant Field Values

  - ### ATTR_METHOD

    public static final int ATTR_METHOD
    See Also:
      - Constant Field Values

  - ### ATTR_WIDTH

    public static final int ATTR_WIDTH
    See Also:
      - Constant Field Values

  - ### ATTR_HEIGHT

    public static final int ATTR_HEIGHT
    See Also:
      - Constant Field Values

  - ### ATTR_ALT

    public static final int ATTR_ALT
    See Also:
      - Constant Field Values

  - ### ATTR_HSPACE

    public static final int ATTR_HSPACE
    See Also:
      - Constant Field Values

  - ### ATTR_VSPACE

    public static final int ATTR_VSPACE
    See Also:
      - Constant Field Values

  - ### ATTR_LONGDESC

    public static final int ATTR_LONGDESC
    See Also:
      - Constant Field Values

  - ### ATTR_LOCALSRC

    public static final int ATTR_LOCALSRC
    See Also:
      - Constant Field Values

  - ### ATTR_SRC

    public static final int ATTR_SRC
    See Also:
      - Constant Field Values

  - ### ATTR_SIZE

    public static final int ATTR_SIZE
    See Also:
      - Constant Field Values

  - ### ATTR_CHECKED

    public static final int ATTR_CHECKED
    See Also:
      - Constant Field Values

  - ### ATTR_EMPTYOK

    public static final int ATTR_EMPTYOK
    See Also:
      - Constant Field Values

  - ### ATTR_FORMAT

    public static final int ATTR_FORMAT
    See Also:
      - Constant Field Values

  - ### ATTR_ISTYLE

    public static final int ATTR_ISTYLE
    See Also:
      - Constant Field Values

  - ### ATTR_MAXLENGTH

    public static final int ATTR_MAXLENGTH
    See Also:
      - Constant Field Values

  - ### ATTR_NAME

    public static final int ATTR_NAME
    See Also:
      - Constant Field Values

  - ### ATTR_VALUE

    public static final int ATTR_VALUE
    See Also:
      - Constant Field Values

  - ### ATTR_FOR

    public static final int ATTR_FOR
    See Also:
      - Constant Field Values

  - ### ATTR_XMLSPACE

    public static final int ATTR_XMLSPACE
    See Also:
      - Constant Field Values

  - ### ATTR_MULTIPLE

    public static final int ATTR_MULTIPLE
    See Also:
      - Constant Field Values

  - ### ATTR_SELECTED

    public static final int ATTR_SELECTED
    See Also:
      - Constant Field Values

  - ### ATTR_ABBR

    public static final int ATTR_ABBR
    See Also:
      - Constant Field Values

  - ### ATTR_AXIS

    public static final int ATTR_AXIS
    See Also:
      - Constant Field Values

  - ### ATTR_COLSPAN

    public static final int ATTR_COLSPAN
    See Also:
      - Constant Field Values

  - ### ATTR_HEADERS

    public static final int ATTR_HEADERS
    See Also:
      - Constant Field Values

  - ### ATTR_ROWSPAN

    public static final int ATTR_ROWSPAN
    See Also:
      - Constant Field Values

  - ### ATTR_SCOPE

    public static final int ATTR_SCOPE
    See Also:
      - Constant Field Values

  - ### ATTR_VALIGN

    public static final int ATTR_VALIGN
    See Also:
      - Constant Field Values

  - ### ATTR_START

    public static final int ATTR_START
    See Also:
      - Constant Field Values

  - ### ATTR_MEDIA

    public static final int ATTR_MEDIA
    See Also:
      - Constant Field Values

  - ### ATTR_LABEL

    public static final int ATTR_LABEL
    See Also:
      - Constant Field Values

  - ### ATTR_SUMMARY

    public static final int ATTR_SUMMARY
    See Also:
      - Constant Field Values

  - ### ATTR_CONTENT

    public static final int ATTR_CONTENT
    See Also:
      - Constant Field Values

  - ### ATTR_HTTPEQUIV

    public static final int ATTR_HTTPEQUIV
    See Also:
      - Constant Field Values

  - ### ATTR_SCHEME

    public static final int ATTR_SCHEME
    See Also:
      - Constant Field Values

  - ### ATTR_COLS

    public static final int ATTR_COLS
    See Also:
      - Constant Field Values

  - ### ATTR_ROWS

    public static final int ATTR_ROWS
    See Also:
      - Constant Field Values

  - ### ATTR_DIR

    public static final int ATTR_DIR
    See Also:
      - Constant Field Values

  - ### ATTR_BORDER

    public static final int ATTR_BORDER
    See Also:
      - Constant Field Values

  - ### ATTR_COLOR

    public static final int ATTR_COLOR
    See Also:
      - Constant Field Values

  - ### ATTR_FACE

    public static final int ATTR_FACE
    See Also:
      - Constant Field Values

  - ### ATTR_SHAPE

    public static final int ATTR_SHAPE
    See Also:
      - Constant Field Values

  - ### ATTR_COORDS

    public static final int ATTR_COORDS
    See Also:
      - Constant Field Values

  - ### ATTR_USEMAP

    public static final int ATTR_USEMAP
    See Also:
      - Constant Field Values

  - ### ATTR_LANG

    public static final int ATTR_LANG
    See Also:
      - Constant Field Values

  - ### ATTR_CELLSPACING

    public static final int ATTR_CELLSPACING
    See Also:
      - Constant Field Values

  - ### ATTR_CELLPADDING

    public static final int ATTR_CELLPADDING
    See Also:
      - Constant Field Values

  - ### ATTR_FRAME

    public static final int ATTR_FRAME
    See Also:
      - Constant Field Values

  - ### ATTR_RULES

    public static final int ATTR_RULES
    See Also:
      - Constant Field Values

  - ### ATTR_DISABLED

    public static final int ATTR_DISABLED
    See Also:
      - Constant Field Values

  - ### ATTR_READONLY

    public static final int ATTR_READONLY
    See Also:
      - Constant Field Values

  - ### ATTR_ISMAP

    public static final int ATTR_ISMAP
    See Also:
      - Constant Field Values

  - ### COLOR_AQUA

    public static final int COLOR_AQUA
    ///////////////////////////////
    See Also:
      - Constant Field Values

  - ### COLOR_BLACK

    public static final int COLOR_BLACK
    See Also:
      - Constant Field Values

  - ### COLOR_BLUE

    public static final int COLOR_BLUE
    See Also:
      - Constant Field Values

  - ### COLOR_FUCHSIA

    public static final int COLOR_FUCHSIA
    See Also:
      - Constant Field Values

  - ### COLOR_GRAY

    public static final int COLOR_GRAY
    See Also:
      - Constant Field Values

  - ### COLOR_GREEN

    public static final int COLOR_GREEN
    ///////////////////////////////
    See Also:
      - Constant Field Values

  - ### COLOR_LIME

    public static final int COLOR_LIME
    See Also:
      - Constant Field Values

  - ### COLOR_MAROON

    public static final int COLOR_MAROON
    See Also:
      - Constant Field Values

  - ### COLOR_NAVY

    public static final int COLOR_NAVY
    See Also:
      - Constant Field Values

  - ### COLOR_OLIVE

    public static final int COLOR_OLIVE
    See Also:
      - Constant Field Values

  - ### COLOR_PURPLE

    public static final int COLOR_PURPLE
    See Also:
      - Constant Field Values

  - ### COLOR_RED

    public static final int COLOR_RED
    See Also:
      - Constant Field Values

  - ### COLOR_SILVER

    public static final int COLOR_SILVER
    See Also:
      - Constant Field Values

  - ### COLOR_TEAL

    public static final int COLOR_TEAL
    See Also:
      - Constant Field Values

  - ### COLOR_WHITE

    public static final int COLOR_WHITE
    See Also:
      - Constant Field Values

  - ### COLOR_YELLOW

    public static final int COLOR_YELLOW
    See Also:
      - Constant Field Values

  - ### COLOR_ORANGE

    public static final int COLOR_ORANGE
    See Also:
      - Constant Field Values

- ## 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

    public HTMLElement(String tagName)

    Constructor for HTMLElement. This mostly sets up the element's ID.

    ###### Parameters

    - `tagName`: The HTMLElement's name

  - ### HTMLElement

    public HTMLElement(String tagName, boolean isTextElement)

    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

    public 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.

    ###### 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:
      `setAttribute` in class `Element`

  - ### setAttributeById

    public void setAttributeById(int attrId, String value)

    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

    public String 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

    public String getTagName()

    Returns this HTMLElement's tag name

    ###### Returns

    the HTMLElement's tag name

    Overrides:
      `getTagName` in class `Element`

  - ### 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

    public HTMLElement getFirstChildByTagId(int tagId)

    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

    public String getAttributeById(int id)

    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

    public String toString()

    {

    Returns a printable string representing this element

    ###### Returns

    a printable string representing this element

    }
    Overrides:
      `toString` in class `Element`

  - ### getAttributeName

    public String getAttributeName(Integer attrKey)

    Returns the attribute name of the requested attribute

    ###### Parameters

    - `attrKey`: The attribute key, which is typically an Integer object made of its int attrId

    ###### Returns

    the attribute name of the requested attribute

  - ### getAttribute

    public String getAttribute(String name)
    Description copied from class: `Element`

    Returns 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:
      `getAttribute` in class `Element`

  - ### toString

    public String toString(String spacing)

    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

    Overrides:
      `toString` in class `Element`

  - ### removeChildAt

    public void removeChildAt(int index)

    {

    Removes the child at the given index

    ###### Parameters

    - `index`: The child's index
    }
    Overrides:
      `removeChildAt` in class `Element`

  - ### getDescendantsByTagId

    public Vector getDescendantsByTagId(int tagId, int depth)

    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

    public Vector getDescendantsByTagId(int tagId)

    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