Package Torello.HTML.NodeSearch
Class TagNodeInclusiveIterator
- java.lang.Object
-
- Torello.HTML.NodeSearch.TagNodeInclusiveIterator
-
public class TagNodeInclusiveIterator extends java.lang.Object
TagNodeInclusiveIterator 🠞
TagNode:
This implies that only HTMLTagNode's
will be used for searching. The fieldTagNode.tok
field is used as a search criteria. Thispublic, final String
field contains the name of the HTML Element - for instance,'div', 'p', 'span', 'img'
, etc...
InnerTag's - (a.k.a. 'attributes') - are not part of the search.
Inclusive:
The word "Inclusive" is used to indicate that allHTMLNode's
between an opening and closing HTML-tag is requested. The concept is extremely similar to the Java-Script feature / "term"'.innerHTML'
, although in this (JavaHTML) JAR Library, noDOM Trees
are ever constructed. This method will return all nodes between the first matchingTagNode
element, and its closingTagNode
element pair.
Iterator:
This means that javaIterator's
(extension ofjava.util.ListIterator<E>
) are returned, rather than simple-results or vectors of results.Iterator's
make updating aVector<HTMLNode>
much easier (by avoiding the problems caused by stale index-pointers), and usually simply many of the retrieval & removal operations when large HTMLTABLE
andUL / OL
are involved.
Static
methods for building anHNLIInclusive
(which also extends the basicIterator
) for retrieving sub HTML-Vector's via user-provided match-critera that specify the HTML Tag-Name..
Methods Available
Method Explanation iter (...) Returns a java HNLIInclusive
that iterates through each node on the html-pageVector
which meets the criteria specified.exceptIter (...) Returns a java HNLIInclusive
that iterates through each node on the html-pageVector
which does not meet the criteria specified.Method Parameters
Parameter Explanation Vector<? extends HTMLNode> html
This represents any vectorized HTML page, sub-page, or list of partial-elements. TC tagCriteria
The three values of enumeration TC
are:TC.OpeningTags, TC.ClosingTags
andTC.Both
. These values specify a search-criteria result set for an HTMLTagNode
. There are two types of HTML Elements:- "opening versions" of the HTML-tag such as:
<A HREF="...">
- "closing versions" of the element such as:
</A>
.
NOTE: If parameter'tagCriteria'
is passed a value ofTC.Both
, then (and this is hopefully obvious), that both 'opening' and 'closing' versions of the tag will be considered to meet / match the search criteria.String... htmlTags
When this parameter is present, only HTMLNode's
which are both instances ofclass TagNode
*and* whoseTagNode.tok
fieldString
-value matches (is equal to) at least one of the elements in thisVarArgs String
parameter-set will be considered for a match.
COMMON EXAMPLES: Some common examples of valid htmlTags are:a, div, img, table, tr, meta
as well as all other valid HTML element-tokens.
NOTE: This comparison is performed using a case-insensitive compare-method
EXCEPTIONS: If even one of the elements in this parameter-set is an invalid HTML token, anHTMLTokException
will be thrown.Return Values:
All methods return an implementation of Iterator:HNLIInclusive
which returns, one-at-a-time,Vector<TagNode>
which are sublists - out of the vectorized-HTML page parameter'html'
.
Hi-Lited Source-Code:- View Here: Torello/HTML/NodeSearch/TagNodeInclusiveIterator.java
- Open New Browser-Tab: Torello/HTML/NodeSearch/TagNodeInclusiveIterator.java
File Size: 1,222 Bytes Line Count: 38 '\n' Characters Found
Stateless Class:This class neither contains any program-state, nor can it be instantiated. The@StaticFunctional
Annotation may also be called 'The Spaghetti Report'.Static-Functional
classes are, essentially, C-Styled Files, without any constructors or non-static member fields. It is a concept very similar to the Java-Bean's@Stateless
Annotation.
- 1 Constructor(s), 1 declared private, zero-argument constructor
- 2 Method(s), 2 declared static
- 0 Field(s)
-
-
Method Summary
Iterate Matches Modifier and Type Method static HNLIInclusive
iter(Vector<? extends HTMLNode> html, String... htmlTags)
Iterate Non-Matches Modifier and Type Method static HNLIInclusive
exceptIter(Vector<? extends HTMLNode> html, String... htmlTags)
-