|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.openexchange.mail.text.parser.handler.HTML2TextHandler
public final class HTML2TextHandler
HTML2TextHandler - A handler to generate plain text version from parsed HTML content which is then accessible via
getText().
| Constructor Summary | |
|---|---|
HTML2TextHandler(int capacity,
boolean appendHref)
Initializes a new HTML2TextHandler. |
|
| Method Summary | |
|---|---|
java.lang.String |
getText()
Gets the extracted text. |
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 <?xml... |
HTML2TextHandler |
reset()
Resets this handler for re-usage |
void |
setContextId(int contextId)
Sets the context ID for debugging purpose on handleError(String). |
void |
setMailFolderPath(java.lang.String mailFolderPath)
Sets the mail folder path for debugging purpose on handleError(String). |
void |
setMailId(long mailId)
Sets the mail ID for debugging purpose on handleError(String). |
void |
setUserId(int userId)
Sets the user ID for debugging purpose on handleError(String). |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HTML2TextHandler(int capacity,
boolean appendHref)
HTML2TextHandler.
capacity - The initial capacityappendHref - true to append URLs contained in hrefs and srcs; otherwise false.<a href=\"www.somewhere.com\">Link<a> would be Link [www.somewhere.com]| Method Detail |
|---|
public java.lang.String getText()
public void setMailFolderPath(java.lang.String mailFolderPath)
handleError(String).
mailFolderPath - The mail folder path to setpublic void setMailId(long mailId)
handleError(String).
mailId - The mail ID to setpublic void setUserId(int userId)
handleError(String).
userId - The user ID to setpublic void setContextId(int contextId)
handleError(String).
contextId - The context ID to setpublic void handleComment(java.lang.String comment)
HTMLHandler
handleComment in interface HTMLHandlercomment - The commentpublic void handleDocDeclaration(java.lang.String docDecl)
HTMLHandler
'<!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"'
handleDocDeclaration in interface HTMLHandlerpublic void handleEndTag(java.lang.String tag)
HTMLHandler
handleEndTag in interface HTMLHandlertag - The tag's namepublic void handleError(java.lang.String errorMsg)
HTMLHandler
handleError in interface HTMLHandlererrorMsg - The error message
public void handleSimpleTag(java.lang.String tag,
java.util.Map<java.lang.String,java.lang.String> attributes)
HTMLHandler
handleSimpleTag in interface HTMLHandlertag - The tag's nameattributes - The tag's attributes as an unmodifiable map
public void handleStartTag(java.lang.String tag,
java.util.Map<java.lang.String,java.lang.String> attributes)
HTMLHandler
handleStartTag in interface HTMLHandlertag - The tag's nameattributes - The tag's attributes as an unmodifiable mappublic void handleCDATA(java.lang.String text)
HTMLHandler
handleCDATA in interface HTMLHandlertext - The CDATA segment's text
public void handleText(java.lang.String text,
boolean ignorable)
HTMLHandlerNote: 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.
handleText in interface HTMLHandlertext - The textignorable - true if specified text may be ignored since it only serves for formatting; otherwise falsepublic HTML2TextHandler reset()
public void handleXMLDeclaration(java.lang.String version,
java.lang.Boolean standalone,
java.lang.String encoding)
HTMLHandler
handleXMLDeclaration in interface HTMLHandlerversion - The version; either "1.0" or nullstandalone - The standalone boolean value; either Boolean.TRUE, Boolean.FALSE, or nullencoding - The encoding; the charset name or null
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||