com.silverpeas.mailinglist.service.util
Class Html2Text

java.lang.Object
  extended by javax.swing.text.html.HTMLEditorKit.ParserCallback
      extended by com.silverpeas.mailinglist.service.util.Html2Text
All Implemented Interfaces:
HtmlCleaner

public class Html2Text
extends HTMLEditorKit.ParserCallback
implements HtmlCleaner

HTML parser, used to extract text form the HTML.

Author:
Emmanuel Hugonnet

Field Summary
 
Fields inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback
IMPLIED
 
Constructor Summary
Html2Text()
          Constructor.
Html2Text(int maxSize)
          Constructor.
 
Method Summary
 String getSummary()
           
 void handleComment(char[] data, int pos)
           
 void handleEndOfLineString(String eol)
           
 void handleEndTag(HTML.Tag t, int pos)
           
 void handleError(String errorMsg, int pos)
           
 void handleSimpleTag(HTML.Tag t, MutableAttributeSet a, int pos)
           
 void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos)
           
 void handleText(char[] text, int pos)
           
 void parse(Reader in)
           
 void setSummarySize(int maxSize)
           
 
Methods inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback
flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Html2Text

public Html2Text()
Constructor.


Html2Text

public Html2Text(int maxSize)
Constructor.

Parameters:
maxSize - the maximum size of the extracted text.
Method Detail

setSummarySize

public void setSummarySize(int maxSize)
Specified by:
setSummarySize in interface HtmlCleaner

handleStartTag

public void handleStartTag(HTML.Tag t,
                           MutableAttributeSet a,
                           int pos)
Overrides:
handleStartTag in class HTMLEditorKit.ParserCallback

handleError

public void handleError(String errorMsg,
                        int pos)
Overrides:
handleError in class HTMLEditorKit.ParserCallback

handleEndTag

public void handleEndTag(HTML.Tag t,
                         int pos)
Overrides:
handleEndTag in class HTMLEditorKit.ParserCallback

parse

public void parse(Reader in)
           throws IOException
Specified by:
parse in interface HtmlCleaner
Throws:
IOException

handleText

public void handleText(char[] text,
                       int pos)
Overrides:
handleText in class HTMLEditorKit.ParserCallback

handleEndOfLineString

public void handleEndOfLineString(String eol)
Overrides:
handleEndOfLineString in class HTMLEditorKit.ParserCallback

handleComment

public void handleComment(char[] data,
                          int pos)
Overrides:
handleComment in class HTMLEditorKit.ParserCallback

handleSimpleTag

public void handleSimpleTag(HTML.Tag t,
                            MutableAttributeSet a,
                            int pos)
Overrides:
handleSimpleTag in class HTMLEditorKit.ParserCallback

getSummary

public String getSummary()
Specified by:
getSummary in interface HtmlCleaner


Copyright © 2016 Silverpeas. All Rights Reserved.