com.openexchange.mail.text.parser
Interface HTMLHandler

All Known Implementing Classes:
DumperHTMLHandler, HTML2TextHandler, HTMLFilterHandler, HTMLImageFilterHandler

public interface HTMLHandler

HTMLHandler

Author:
Thorben Betten

Method Summary
 void handleCDATA(java.lang.String text)
          Handles specified CDATA segment's text; e.g.
 void handleComment(java.lang.String comment)
          Handles specified comment.
 void handleDocDeclaration(java.lang.String docDecl)
          Handles the DOCTYPE declaration.
 void handleEndTag(java.lang.String tag)
          Handles specified end tag.
 void handleError(java.lang.String errorMsg)
          Handles specified error.
 void handleSimpleTag(java.lang.String tag, java.util.Map<java.lang.String,java.lang.String> attributes)
          Handles specified simple tag.
 void handleStartTag(java.lang.String tag, java.util.Map<java.lang.String,java.lang.String> attributes)
          Handles specified start tag.
 void handleText(java.lang.String text, boolean ignorable)
          Handles specified text.
 void handleXMLDeclaration(java.lang.String version, java.lang.Boolean standalone, java.lang.String encoding)
          Handles the <?
 

Method Detail

handleXMLDeclaration

void handleXMLDeclaration(java.lang.String version,
                          java.lang.Boolean standalone,
                          java.lang.String encoding)
Handles the <?xml... ?> declaration.

Parameters:
version - The version; either "1.0" or null
standalone - The standalone boolean value; either Boolean.TRUE, Boolean.FALSE, or null
encoding - The encoding; the charset name or null

handleDocDeclaration

void handleDocDeclaration(java.lang.String docDecl)
Handles the DOCTYPE declaration. Specified value is without leading "<!DOCTYPE" and without trailing ">"; e.g.
 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
 
yields
  ' html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"'
 

Parameters:
docDecl -

handleCDATA

void handleCDATA(java.lang.String text)
Handles specified CDATA segment's text; e.g. 'fo<o' from '<![CDATA[fo<o]]>'.

Parameters:
text - The CDATA segment's text

handleText

void handleText(java.lang.String text,
                boolean ignorable)
Handles specified text.

Note: Specified text contains all control characters from corresponding HTML content; e.g.:

 Sorry if my article tried to imply that this is a
           new thing (I hope it hasn't).
 
will be given as:
 Sorry if my article tried to imply that this is a
           new thing (I hope it hasn't).
 

Note: A text only containing whitespace characters is omitted.

Parameters:
text - The text
ignorable - true if specified text may be ignored since it only serves for formatting; otherwise false

handleComment

void handleComment(java.lang.String comment)
Handles specified comment. Specified value is without leading "<!--" and without trailing "-->".

Parameters:
comment - The comment

handleStartTag

void handleStartTag(java.lang.String tag,
                    java.util.Map<java.lang.String,java.lang.String> attributes)
Handles specified start tag.

Parameters:
tag - The tag's name
attributes - The tag's attributes as an unmodifiable map

handleEndTag

void handleEndTag(java.lang.String tag)
Handles specified end tag.

Parameters:
tag - The tag's name

handleSimpleTag

void handleSimpleTag(java.lang.String tag,
                     java.util.Map<java.lang.String,java.lang.String> attributes)
Handles specified simple tag.

Parameters:
tag - The tag's name
attributes - The tag's attributes as an unmodifiable map

handleError

void handleError(java.lang.String errorMsg)
Handles specified error.

Parameters:
errorMsg - The error message
Throws:
java.lang.IllegalStateException - If handler decides that occurred error is worth being thrown