Class TagNodeInclusiveIterator

  • public class TagNodeInclusiveIterator
    extends java.lang.Object
    TagNodeInclusiveIterator 🠞
    1. TagNode: This implies that only HTML TagNode's will be used for searching. The field TagNode.tok field is used as a search criteria. This public, 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.

    2. Inclusive: The word "Inclusive" is used to indicate that all HTMLNode'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, no DOM Trees are ever constructed. This method will return all nodes between the first matching TagNode element, and its closing TagNode element pair.

    3. Iterator: This means that java Iterator's (extension of java.util.ListIterator<E>) are returned, rather than simple-results or vectors of results. Iterator's make updating a Vector<HTMLNode> much easier (by avoiding the problems caused by stale index-pointers), and usually simply many of the retrieval & removal operations when large HTML TABLE and UL / OL are involved.
    Static methods for building an HNLIInclusive (which also extends the basic Iterator) 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-page Vector which meets the criteria specified.
    exceptIter (...) Returns a java HNLIInclusive that iterates through each node on the html-page Vector 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 and TC.Both. These values specify a search-criteria result set for an HTML TagNode. 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 of TC.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 of class TagNode *and* whose TagNode.tok field String-value matches (is equal to) at least one of the elements in this VarArgs 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, an HTMLTokException 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'.

    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)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait