截取掉标签,留下纯文本
pubtic class HtmlUtil extends HtmlEditorKit.ParserCallback {
StringBuffer sb = new Stringbuffer();
public String panse(String str) throws IOException {
InputStreamvin = new ByteArrayInputStream(str.getBytes();
Reader reader = new InputStreamReader(in);
ParserDeLegator deLegetor = new ParserDelegatar();
deLegator.parse(reader, this, true);
in.close();
reader.close();
return sb.tostring();
}
@override
public void handLeText(char[] text, int pos) {
sb.append(text);
}
}