Class InclusiveException

  • All Implemented Interfaces:

    public class InclusiveException
    extends java.lang.IllegalArgumentException
    An Inclusive-Exception indicates that a user has tried to perform an "Inclusive Search" on an HTML Tag that cannot have sub-nodes or descendant-nodes. The most common examples of inclusive search parameters for HTML tags would be the HTML elements: DIV, P, SPAN, A, TABLE, H1..H6.

    These are the HTML elements whose primary purpose is to "surround" a block of HTML or, a some plain-text (in the case of the "anchor element" <A HREF="...">). An inclusive search does just what one might think would be good to do with "container" HTML elements, it captures each and every HTMLNode between the opening and closing HTML TagNode's.

    Inclusive Java-Script Similarity:
     var divElement = document.getElementById("article-container");
     var articleHTML = divElement.innerHTML;

    The above two lines of "Java-Script," above, would loosely "translate" to the following java-code below:

     Vector<HTMLNode> article = InnerTagGetInclusive.first
          (some_page, "div", "class", val -> val.equals("article-container"));
     String articleAsStr = Util.pageToString(article);

    Examples of "Inclusive Search" that would cause a throw new InclusiveException(message) would be using the "Inclusive Methods" in this Node-Search Package - and naming any of the following HTML Elements:
    • <BR>
    • <IMG SRC="...">
    • <HR>
    • <META ...>
    • <INPUT ID="...">

    Each of the previously listed HTML elements only have an opening tag version, they never need to be closed! An InclusiveException is generated if an attempt is made to find an opening-closing pair when there may not be one, according to the HTML specifications. These are sometimes called "stand-alone" or "empty" HTML elements. They are also often called "self-closing" tags.
    See Also:
    Serialized Form

    • Field Summary

      Serializable ID
      Modifier and Type Field
      static long serialVersionUID
    • Method Summary

      'static' Exception Check Methods
      Modifier and Type Method
      static void check​(String... htmlTags)
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • serialVersionUID

        public static final long serialVersionUID
        This fulfils the SerialVersion UID requirement for all classes that implement Java's interface Using the Serializable Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.

        Note that Java's java.lang.Exception and java.lang.Error classes implement the Serializable interface, and a warning-free build expects this field be defined here.
        See Also:
        Constant Field Values
        Exact Field Declaration Expression:
         public static final long serialVersionUID = 1;
    • Constructor Detail

      • InclusiveException

        🡅  🡇    
        public InclusiveException​(java.lang.String message)
        Constructs an InclusiveException with the specified detail message.
        message - the detail message.
      • InclusiveException

        🡅  🡇    
        public InclusiveException​(java.lang.String message,
                                  java.lang.Throwable cause)
        Constructs a new exception with the specified detail message and cause.

        NOTE: The detail message associated with cause is not automatically incorporated in this exception's detail message.
        message - The detail message (which is saved for later retrieval by the Throwable.getMessage() method).
        cause - the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
      • InclusiveException

        🡅  🡇    
        public InclusiveException​(java.lang.Throwable cause)
        Constructs a new exception with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause). This constructor is useful for exceptions that are little more than wrappers for other throwables.
        cause - The cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
    • Method Detail

      • check

        public static void check​(java.lang.String... htmlTags)
        Checks either one, or a list, of html-tags (same as the TagNode.tok) to make sure they are not "singleton" (sometimes called 'empty' HTML elements. If the parameter(s) are empty/singleton HTML elements, this method will automatically throw an InclusiveException.
        htmlTags - This may be any Java String (or String's), but only Java-String's that are found to be valid HTML 4 or 5 tags will be accepted.

        NOTE: The String... (var-args) syntax means multiple tags may be tested. If one is found to be invalid, an InclusiveEception is immediately thrown.
        See Also:
        Exact Method Body:
         for (String tok : htmlTags)
             if (tok != null) if (HTMLTags.isSingleton(tok)) throw new InclusiveException (
                 "The HTML Element '" + tok + "' may not have an inclusive search performed " +
                 "with it, because it is a singleton HTML element."