Class MicrosoftConditionalCommentTagTypes

java.lang.Object
MicrosoftConditionalCommentTagTypes

public final class MicrosoftConditionalCommentTagTypes extends 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.