Logo Search packages:      
Sourcecode: jericho-html version File versions  Download package

au::id::jericho::lib::html::Element Class Reference

Inheritance diagram for au::id::jericho::lib::html::Element:

au::id::jericho::lib::html::Segment au::id::jericho::lib::html::HTMLElementName

List of all members.


Detailed Description

Represents an element in a specific Source source} document, which encompasses a getStartTag() start tag}, an optional getEndTag() end tag} and all getContent() content} in between.

The term normal element refers to an element having a getStartTag() start tag} with a StartTag::getStartTagType() type} of StartTagType#NORMAL. This comprises all HTMLElements HTML elements} and non-HTML elements.

Element instances are obtained using one of the following methods:

See also the HTMLElements class, and the XML 1.0 specification for elements.

Element Structure

The three possible structures of an element are listed below:

Single Tag Element:
The element consists only of a single getStartTag() start tag} and has no getContent() element content} (although the start tag itself may have StartTag::getTagContent() tag content}).
getEndTag()==null
isEmpty()==true
getEnd()==getStartTag().getEnd()

This occurs in the following situations:

Explicitly Terminated Element:
The element consists of a getStartTag() start tag}, getContent() content}, and an getEndTag() end tag}.
getEndTag()!=null.
isEmpty()==false (provided the end tag doesn't immediately follow the start tag)
getEnd()==getEndTag().getEnd().

This occurs in the following situations, assuming the start tag's matching end tag is present in the source document:

Implicitly Terminated Element:
The element consists of a getStartTag() start tag} and getContent() content}, but no getEndTag() end tag}.
getEndTag()==null.
isEmpty()==false
getEnd()!=getStartTag().getEnd().

This only occurs in an HTML element for which the HTMLElements::getEndTagOptionalElementNames() end tag is optional}.

The element ends at the start of a tag which implies the termination of the element, called the implicitly terminating tag. If the implicitly terminating tag is situated immediately after the element's getStartTag() start tag}, the element is classed as a single tag element.

See the element parsing rules for HTML elements with optional end tags for details on which tags can implicitly terminate a given element.

See also the documentation of the HTMLElements#getEndTagOptionalElementNames() method.

Element Parsing Rules

The following rules describe the algorithm used in the StartTag#getElement() method to construct an element. The detection of the start tag's matching end tag or other terminating tags always takes into account the possible nesting of elements.

See also:
HTMLElements

Definition at line 220 of file Element.java.


Public Member Functions

final char charAt (final int index)
int compareTo (final Object o)
final boolean encloses (final int pos)
final boolean encloses (final Segment segment)
final boolean equals (final Object object)
String extractText (final boolean includeAttributes)
String extractText ()
List findAllCharacterReferences ()
List findAllComments ()
List findAllElements (final StartTagType startTagType)
List findAllElements (String name)
List findAllElements ()
List findAllStartTags (final String attributeName, final String value, final boolean valueCaseSensitive)
List findAllStartTags (String name)
List findAllStartTags ()
List findAllTags (final TagType tagType)
List findAllTags ()
List findFormControls ()
FormFields findFormFields ()
final List findWords ()
Attributes getAttributes ()
String getAttributeValue (final String attributeName)
final int getBegin ()
final List getChildElements ()
Segment getContent ()
String getContentText ()
String getDebugInfo ()
int getDepth ()
final int getEnd ()
EndTag getEndTag ()
FormControl getFormControl ()
String getName ()
Element getParentElement ()
String getSourceText ()
final String getSourceTextNoWhitespace ()
StartTag getStartTag ()
int hashCode ()
void ignoreWhenParsing ()
boolean isComment ()
boolean isEmpty ()
boolean isEmptyElementTag ()
final boolean isWhiteSpace ()
final int length ()
Attributes parseAttributes ()
final CharSequence subSequence (final int beginIndex, final int endIndex)
String toString ()

Static Public Member Functions

static boolean isBlock (final String elementName)
static boolean isInline (final String elementName)
static final boolean isWhiteSpace (final char ch)

Static Public Attributes

static final String A = "a"
static final String ABBR = "abbr"
static final String ACRONYM = "acronym"
static final String ADDRESS = "address"
static final String APPLET = "applet"
static final String AREA = "area"
static final String B = "b"
static final String BASE = "base"
static final String BASEFONT = "basefont"
static final String BDO = "bdo"
static final String BIG = "big"
static final String BLOCKQUOTE = "blockquote"
static final String BODY = "body"
static final String BR = "br"
static final String BUTTON = "button"
static final String CAPTION = "caption"
static final String CENTER = "center"
static final String CITE = "cite"
static final String CODE = "code"
static final String COL = "col"
static final String COLGROUP = "colgroup"
static final String DD = "dd"
static final String DEL = "del"
static final String DFN = "dfn"
static final String DIR = "dir"
static final String DIV = "div"
static final String DL = "dl"
static final String DT = "dt"
static final String EM = "em"
static final String FIELDSET = "fieldset"
static final String FONT = "font"
static final String FORM = "form"
static final String FRAME = "frame"
static final String FRAMESET = "frameset"
static final String H1 = "h1"
static final String H2 = "h2"
static final String H3 = "h3"
static final String H4 = "h4"
static final String H5 = "h5"
static final String H6 = "h6"
static final String HEAD = "head"
static final String HR = "hr"
static final String HTML = "html"
static final String I = "i"
static final String IFRAME = "iframe"
static final String IMG = "img"
static final String INPUT = "input"
static final String INS = "ins"
static final String ISINDEX = "isindex"
static final String KBD = "kbd"
static final String LABEL = "label"
static final String LEGEND = "legend"
static final String LI = "li"
static final String LINK = "link"
static final String MAP = "map"
static final String MENU = "menu"
static final String META = "meta"
static final String NOFRAMES = "noframes"
static final String NOSCRIPT = "noscript"
static final String OBJECT = "object"
static final String OL = "ol"
static final String OPTGROUP = "optgroup"
static final String OPTION = "option"
static final String P = "p"
static final String PARAM = "param"
static final String PRE = "pre"
static final String Q = "q"
static final String S = "s"
static final String SAMP = "samp"
static final String SCRIPT = "script"
static final String SELECT = "select"
static final String SMALL = "small"
static final String SPAN = "span"
static final String STRIKE = "strike"
static final String STRONG = "strong"
static final String STYLE = "style"
static final String SUB = "sub"
static final String SUP = "sup"
static final String TABLE = "table"
static final String TBODY = "tbody"
static final String TD = "td"
static final String TEXTAREA = "textarea"
static final String TFOOT = "tfoot"
static final String TH = "th"
static final String THEAD = "thead"
static final String TITLE = "title"
static final String TR = "tr"
static final String TT = "tt"
static final String U = "u"
static final String UL = "ul"
static final String VAR = "var"

Package Functions

 Element (final Source source, final StartTag startTag, final EndTag endTag)
final List getChildElements (int depth)
int getContentEnd ()

Static Package Functions

static final StringBuffer appendCollapseWhiteSpace (final StringBuffer sb, final CharSequence text)

Package Attributes

final int begin
List childElements = null
final int end
Element parentElement = Element.NOT_CACHED
final Source source

Static Package Attributes

static final Element NOT_CACHED = new Element()

Private Attributes

Segment content = null
int depth = -1
final EndTag endTag
final StartTag startTag

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index