de.fh_mannheim.mm.dms.framework.converters
Class HTML2Text

java.lang.Object
  extended byjavax.swing.text.html.HTMLEditorKit.ParserCallback
      extended byde.fh_mannheim.mm.dms.framework.converters.HTML2Text
All Implemented Interfaces:
IConverter

public class HTML2Text
extends javax.swing.text.html.HTMLEditorKit.ParserCallback
implements IConverter

FileConverter is a html parser, which converts html to plaintext.

Version:
$Revision: 1.17 $
Author:
Jan Löffler, mail@jlsoft.de

Field Summary
static java.lang.String[] HTML_CHARS
           
static java.lang.String[] TEXT_CHARS
          Chars to convert from HTML to text
 
Fields inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback
IMPLIED
 
Constructor Summary
HTML2Text()
          Constructor.
 
Method Summary
static java.lang.StringBuffer convertChars(java.lang.StringBuffer strText)
          Returns plaintext without specialcharcodes.
 void handleText(char[] text, int pos)
          Append found text.
 java.lang.StringBuffer parse(java.lang.String strFilename)
          Parse html-file.
static java.lang.String removeTags(java.lang.String strText)
          Removes all tags in html.
static java.lang.StringBuffer removeTags(java.lang.StringBuffer strText)
          Removes all tags in html.
 
Methods inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback
flush, handleComment, handleEndOfLineString, handleEndTag, handleError, handleSimpleTag, handleStartTag
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEXT_CHARS

public static final java.lang.String[] TEXT_CHARS
Chars to convert from HTML to text


HTML_CHARS

public static final java.lang.String[] HTML_CHARS
Constructor Detail

HTML2Text

public HTML2Text()
Constructor.

Method Detail

convertChars

public static java.lang.StringBuffer convertChars(java.lang.StringBuffer strText)
Returns plaintext without specialcharcodes.

Parameters:
strText - Text to convert
Returns:
plaintext

handleText

public void handleText(char[] text,
                       int pos)
Append found text.

Parameters:
text - Found text
pos - Position of found text

parse

public java.lang.StringBuffer parse(java.lang.String strFilename)
Parse html-file.

Parameters:
strFilename - HTML-file
Returns:
plaintext

removeTags

public static java.lang.String removeTags(java.lang.String strText)
Removes all tags in html.

Parameters:
strText - Text to be cleared
Returns:
Cleared text

removeTags

public static java.lang.StringBuffer removeTags(java.lang.StringBuffer strText)
Removes all tags in html.

Parameters:
strText - Text to be cleared
Returns:
Cleared text