Package Torello.HTML.NodeSearch
Class TagNodeIterator
- java.lang.Object
-
- Torello.HTML.NodeSearch.TagNodeIterator
-
public class TagNodeIterator extends java.lang.Object
TagNodeIterator 🠞
TagNode:
This implies that only HTMLTagaNode'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.
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 and instantiating anHNLI
<
TagNode
>
(which extends the basic iterator class) for iterating the tags inside of an HTML-Vector
, using explicitly provided match-specifications.
Methods Available
Method Explanation iter (...) Returns a java HNLI<TagNode>
that iterates through each node on the html-pageVector
which meets the criteria specified.exceptIter (...) Returns a java HNLI<TagNode>
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:HNLI<TagNode>
which returns, one-at-a-time,TagNode's
out of the vectorized-HTML page parameter'html'
.
Hi-Lited Source-Code:- View Here: Torello/HTML/NodeSearch/TagNodeIterator.java
- Open New Browser-Tab: Torello/HTML/NodeSearch/TagNodeIterator.java
File Size: 1,242 Bytes Line Count: 37 '\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)