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'swill be used for searching. The fieldTagNode.tokfield is used as a search criteria. Thispublic, final Stringfield 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'smake 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 HTMLTABLEandUL / OLare involved.
Staticmethods 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-pageVectorwhich meets the criteria specified.exceptIter (...) Returns a java HNLI<TagNode>that iterates through each node on the html-pageVectorwhich does not meet the criteria specified.Method Parameters
Parameter Explanation Vector<? extends HTMLNode> htmlThis represents any vectorized HTML page, sub-page, or list of partial-elements. TC tagCriteriaThe three values of enumeration TCare:TC.OpeningTags, TC.ClosingTagsandTC.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... htmlTagsWhen this parameter is present, only HTMLNode'swhich are both instances ofclass TagNode*and* whoseTagNode.tokfieldString-value matches (is equal to) at least one of the elements in thisVarArgs Stringparameter-set will be considered for a match.
COMMON EXAMPLES: Some common examples of valid htmlTags are:a, div, img, table, tr, metaas 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, anHTMLTokExceptionwill be thrown.Return Values:
All methods return an implementation of Iterator:HNLI<TagNode>which returns, one-at-a-time,TagNode'sout 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,266 Bytes Line Count: 37 '\n' Characters Found
Stateless Class:This class neither contains any program-state, nor can it be instantiated. The@StaticFunctionalAnnotation may also be called 'The Spaghetti Report'.Static-Functionalclasses are, essentially, C-Styled Files, without any constructors or non-static member fields. It is a concept very similar to the Java-Bean's@StatelessAnnotation.
- 1 Constructor(s), 1 declared private, zero-argument constructor
- 2 Method(s), 2 declared static
- 0 Field(s)