MicrosoftConditionalCommentTagTypes
Date: 2016-12-04

net.htmlparser.jericho

## Class MicrosoftConditionalCommentTagTypes

- java.lang.Object
- - net.htmlparser.jericho.MicrosoftConditionalCommentTagTypes

-     public final class MicrosoftConditionalCommentTagTypes
      extends java.lang.Object

  Contains tag types representing Microsoft® conditional comments.

  Officially there are only two types of conditional comment, downlevel-hidden and downlevel-revealed, with each defining a start tag containing an "`if`" expression and an end tag containing the text "`endif`".

  These four official tags are represented by the tag types `DOWNLEVEL_HIDDEN_IF`, `DOWNLEVEL_HIDDEN_ENDIF`, `DOWNLEVEL_REVEALED_IF` and `DOWNLEVEL_REVEALED_ENDIF`.

  The conditional expression of an instance of any of the "`if`" tag types can be extracted using the `StartTag.getTagContent()` method. For example, if the variable `conditionalCommentIfTag` represents the tag `<![if !IE]>`, then the expression `conditionalCommentIfTag.getTagContent().toString().trim()` yields the string "`!IE`".

  Conditional comments are only recognised by Internet Explorer. All other browsers recognise downlevel-hidden conditional comments as normal comments, and ignore downlevel-revealed conditional comment tags as unrecognised.

  The use of downlevel-revealed conditional comments is generally avoided because they represent invalid HTML code. They can however be replaced by functionally equivalent syntactical constructs based on downlevel-hidden conditional comments so that the HTML remains valid. These composite constructs are represented by the tag types `DOWNLEVEL_REVEALED_VALIDATING_IF`, `DOWNLEVEL_REVEALED_VALIDATING_ENDIF` and `DOWNLEVEL_REVEALED_VALIDATING_SIMPLIFIED_IF`.

  Because none of the conditional comment end tags start with "`</`", they are represented in this library as start tag types, and the parser makes no attempt to match if-endif tag pairs to form elements.

  The tag types defined in this class are not registered by default.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static StartTagType` | `DOWNLEVEL_HIDDEN_ENDIF` The tag type given to a downlevel-hidden conditional comment `endif` tag (`<![endif]-->`).
    `static StartTagType` | `DOWNLEVEL_HIDDEN_IF` The tag type given to a downlevel-hidden conditional comment `if` tag (`<!--[if ... ]>`).
    `static StartTagType` | `DOWNLEVEL_REVEALED_ENDIF` The tag type given to a downlevel-revealed conditional comment `endif` tag (`<![endif]>`).
    `static StartTagType` | `DOWNLEVEL_REVEALED_IF` The tag type given to a downlevel-revealed conditional comment `if` tag (`<![if ... ]>`).
    `static StartTagType` | `DOWNLEVEL_REVEALED_VALIDATING_ENDIF` The tag type given to a validating downlevel-revealed conditional comment `endif` tag (`<!--<![endif]-->`).
    `static StartTagType` | `DOWNLEVEL_REVEALED_VALIDATING_IF` The tag type given to a validating downlevel-revealed conditional comment `if` tag (`<!--[if ... ]><!-->`).
    `static StartTagType` | `DOWNLEVEL_REVEALED_VALIDATING_SIMPLIFIED_IF` The tag type given to a validating simplified downlevel-revealed conditional comment `if` tag (`<!--[if ... ]>-->`).

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `defines(TagType tagType)` Indicates whether the specified tag type is defined in this class.
    `static void` | `deregister()` Deregisters all of the tag types defined in this class at once.
    `static void` | `register()` Registers all of the tag types defined in this class at once.

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### DOWNLEVEL_HIDDEN_IF

          public static final StartTagType DOWNLEVEL_HIDDEN_IF

      The tag type given to a downlevel-hidden conditional comment `if` tag (`<!--[if ... ]>`).

      The corresponding end tag is represented by the tag type `DOWNLEVEL_HIDDEN_ENDIF`.

      Properties:

        Property | Value
        --- | ---
        `Description` | Microsoft downlevel-hidden conditional comment IF
        `StartDelimiter` | `<!--[if`
        `ClosingDelimiter` | `]>`
        `IsServerTag` | `false`
        `NamePrefix` | `!--[if`
        `CorrespondingEndTagType` | `null`
        `HasAttributes` | `false`
        `IsNameAfterPrefixRequired` | `false`

      Example:
        `<!--[if IE]>`

    - #### DOWNLEVEL_HIDDEN_ENDIF

          public static final StartTagType DOWNLEVEL_HIDDEN_ENDIF

      The tag type given to a downlevel-hidden conditional comment `endif` tag (`<![endif]-->`).

      The corresponding start tag is represented by the tag type `DOWNLEVEL_HIDDEN_IF`.

      Although this functions as an end tag, it is represented in this library as a start tag type because it does not start with the characters "`</`".

      Properties:

        Property | Value
        --- | ---
        `Description` | Microsoft downlevel-hidden conditional comment ENDIF
        `StartDelimiter` | `<![endif]-->`
        `ClosingDelimiter` | (empty string)
        `IsServerTag` | `false`
        `NamePrefix` | `![endif]-->`
        `CorrespondingEndTagType` | `null`
        `HasAttributes` | `false`
        `IsNameAfterPrefixRequired` | `false`

      Example:
        `<![endif]>`

    - #### DOWNLEVEL_REVEALED_IF

          public static final StartTagType DOWNLEVEL_REVEALED_IF

      The tag type given to a downlevel-revealed conditional comment `if` tag (`<![if ... ]>`).

      The corresponding end tag is represented by the tag type `DOWNLEVEL_REVEALED_ENDIF`.

      Properties:

        Property | Value
        --- | ---
        `Description` | Microsoft downlevel-revealed conditional comment IF
        `StartDelimiter` | `<![if`
        `ClosingDelimiter` | `]>`
        `IsServerTag` | `false`
        `NamePrefix` | `![if`
        `CorrespondingEndTagType` | `null`
        `HasAttributes` | `false`
        `IsNameAfterPrefixRequired` | `false`

      Example:
        `<![if !IE]>`

    - #### DOWNLEVEL_REVEALED_ENDIF

          public static final StartTagType DOWNLEVEL_REVEALED_ENDIF

      The tag type given to a downlevel-revealed conditional comment `endif` tag (`<![endif]>`).

      The corresponding start tag is represented by the tag type `DOWNLEVEL_REVEALED_IF`.

      Although this functions as an end tag, it is represented in this library as a start tag type because it does not start with the characters "`</`".

      Properties:

        Property | Value
        --- | ---
        `Description` | Microsoft downlevel-revealed conditional comment ENDIF
        `StartDelimiter` | `<![endif]>`
        `ClosingDelimiter` | (empty string)
        `IsServerTag` | `false`
        `NamePrefix` | `![endif]>`
        `CorrespondingEndTagType` | `null`
        `HasAttributes` | `false`
        `IsNameAfterPrefixRequired` | `false`

      Example:
        `<![endif]>`

    - #### DOWNLEVEL_REVEALED_VALIDATING_IF

          public static final StartTagType DOWNLEVEL_REVEALED_VALIDATING_IF

      The tag type given to a validating downlevel-revealed conditional comment `if` tag (`<!--[if ... ]><!-->`).

      The corresponding end tag is represented by the tag type `DOWNLEVEL_REVEALED_VALIDATING_ENDIF`.

      This tag is actually a composite syntactical construct containing a downlevel-hidden conditional comment `if` tag.

      Properties:

        Property | Value
        --- | ---
        `Description` | Microsoft downlevel-revealed validating conditional comment IF
        `StartDelimiter` | `<!--[if`
        `ClosingDelimiter` | `]><!-->`
        `IsServerTag` | `false`
        `NamePrefix` | `!--[if`
        `CorrespondingEndTagType` | `null`
        `HasAttributes` | `false`
        `IsNameAfterPrefixRequired` | `false`

      Example:
        `<!--[if !(IE 5)]><!-->`

    - #### DOWNLEVEL_REVEALED_VALIDATING_ENDIF

          public static final StartTagType DOWNLEVEL_REVEALED_VALIDATING_ENDIF

      The tag type given to a validating downlevel-revealed conditional comment `endif` tag (`<!--<![endif]-->`).

      The corresponding start tag is represented by the tag type `DOWNLEVEL_REVEALED_VALIDATING_IF`.

      This tag is actually a composite syntactical construct containing a downlevel-hidden conditional comment `endif` tag.

      Although this functions as an end tag, it is represented in this library as a start tag type because it does not start with the characters "`</`".

      Properties:

        Property | Value
        --- | ---
        `Description` | Microsoft downlevel-revealed validating conditional comment ENDIF
        `StartDelimiter` | `<!--<![endif]-->`
        `ClosingDelimiter` | (empty string)
        `IsServerTag` | `false`
        `NamePrefix` | `!--<![endif]-->`
        `CorrespondingEndTagType` | `null`
        `HasAttributes` | `false`
        `IsNameAfterPrefixRequired` | `false`

      Example:
        `<!--<![endif]-->`

    - #### DOWNLEVEL_REVEALED_VALIDATING_SIMPLIFIED_IF

          public static final StartTagType DOWNLEVEL_REVEALED_VALIDATING_SIMPLIFIED_IF

      The tag type given to a validating simplified downlevel-revealed conditional comment `if` tag (`<!--[if ... ]>-->`).

      This form of validating downlevel-revealed conditional comment must only be used when the condition always evaluated to false in Internet Explorer, which means the condition should be either "`false`" or "`!IE`".

      The corresponding end tag is represented by the tag type `DOWNLEVEL_REVEALED_VALIDATING_ENDIF`, which is identical to the corresponding end tag of `DOWNLEVEL_REVEALED_VALIDATING_IF`.

      This tag is actually a composite syntactical construct containing a downlevel-hidden conditional comment `if` tag.

      Properties:

        Property | Value
        --- | ---
        `Description` | Microsoft downlevel-revealed validating simplified conditional comment IF
        `StartDelimiter` | `<!--[if`
        `ClosingDelimiter` | `]>-->`
        `IsServerTag` | `false`
        `NamePrefix` | `!--[if`
        `CorrespondingEndTagType` | `null`
        `HasAttributes` | `false`
        `IsNameAfterPrefixRequired` | `false`

      Example:
        `<!--[if !IE]>-->`

  - ### Method Detail

    - #### register

          public static void register()

      Registers all of the tag types defined in this class at once.

      The tag types must be registered before the parser will recognise them.

    - #### deregister

          public static void deregister()

      Deregisters all of the tag types defined in this class at once.

    - #### defines

          public static boolean defines(TagType tagType)

      Indicates whether the specified tag type is defined in this class.
      Parameters:
        `tagType` - the `TagType` to test.
      Returns:
        `true` if the specified tag type is defined in this class, otherwise `false`.