Class TagNodeIterator


  • public class TagNodeIterator
    extends java.lang.Object
    TagNodeIterator 🠞
    1. TagNode: This implies that only HTML TagaNode'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. 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 and instantiating an HNLI<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-page Vector which meets the criteria specified.
    exceptIter (...) Returns a java HNLI<TagNode> 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: HNLI<TagNode> which returns, one-at-a-time, TagNode's 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 HNLI<TagNode> iter​(Vector<? extends HTMLNode> html, TC tagCriteria, String... htmlTags)
       
      Iterate Non-Matches
      Modifier and Type Method
      static HNLI<TagNode> exceptIter​(Vector<? extends HTMLNode> html, TC tagCriteria, String... htmlTags)
      • Methods inherited from class java.lang.Object

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