Enum ParseConfiguration.ElementBalancing

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<ParseConfiguration.ElementBalancing>
    Enclosing class:
    ParseConfiguration

    public static enum ParseConfiguration.ElementBalancing
    extends java.lang.Enum<ParseConfiguration.ElementBalancing>

    Enumeration representing the possible actions to be taken with regard to element balancing:

    • NO_BALANCING: Do not perform element balancing checks at all. Events will be reported as they appear. There is no guarantee that a DOM tree can be built from the fired events though.
    • REQUIRE_BALANCED: Require that elements are already correctly balanced in markup, throwing an exception if not. Note that when in HTML mode, this does not require the specification of optional tags such as <tbody>. Also note that this will automatically consider the ParseConfiguration.setNoUnmatchedCloseElementsRequired(boolean) flag to be set to true.
    • AUTO_OPEN_CLOSE: Auto open and close elements, which includes both those elements that, according to the HTML spec (when in HTML mode) have optional start or end tags (see http://www.w3.org/html/wg/drafts/html/master/syntax.html#optional-tags) and those that simply are unclosed at the moment a parent element needs to be closed (so their closing is forced). As an example of optional tags, the HTML5 spec establishes that <html>, <body> and <tbody> are optional, and that an <li> will close any currently open <li> elements. This is not really ill-formed code, but something allowed by the spec. All of these will be reported as auto-* events by the parser.
    • AUTO_CLOSE: Equivalent to AUTO_OPEN_CLOSE but not performing any auto-open operations, so that processing of HTML fragments is possible (no <html> or <body> elements are automatically added).

    This enumeration is used at the ParseConfiguration class.

    • Constructor Detail

      • ElementBalancing

        private ElementBalancing()
    • Method Detail

      • values

        public static ParseConfiguration.ElementBalancing[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (ParseConfiguration.ElementBalancing c : ParseConfiguration.ElementBalancing.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ParseConfiguration.ElementBalancing valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null