Here you can find the source of htmlToPlain(String html)
public static String htmlToPlain(String html)
//package com.java2s; //License from project: Open Source License import javax.swing.text.Document; import javax.swing.text.html.HTMLEditorKit; import java.io.*; public class Main { public static String htmlToPlain(String html) { HTMLEditorKit htmlParser = new HTMLEditorKit(); Document document = htmlParser.createDefaultDocument(); try {//from ww w . jav a 2 s. c om htmlParser.read(new ByteArrayInputStream(html.getBytes()), document, 0); String plain = document.getText(0, document.getLength()); return plain; } catch (Exception e) { throw new RuntimeException("Error converting HTML to plain text", e); } } }