Package jsynoptic.ui

Source Code of jsynoptic.ui.SourceForgeHTMLParser

package jsynoptic.ui;

import org.htmlparser.Parser;
import org.htmlparser.util.ParserException;
import org.htmlparser.visitors.TextExtractingVisitor;

/**
* An implementation of {@link HTMLParser} using the external library Source Forge HTML Parser.
* @author zxpletran007
*
*/
public class SourceForgeHTMLParser implements HTMLParser{

   
    /* (non-Javadoc)
     * @see jsynoptic.ui.HTMLParser#extractText(java.lang.String)
     */
    public String extractText(String htmlPath) {
        String result = "";
        try {
            Parser parser = new Parser (htmlPath);
            TextExtractingVisitor visitor = new TextExtractingVisitor ();
            parser.visitAllNodesWith (visitor);
            result = visitor.getExtractedText();

        } catch (ParserException e1) {
        }
        return result;
    }
}
TOP

Related Classes of jsynoptic.ui.SourceForgeHTMLParser

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.