2009년 10월 6일 화요일

How to remove escaping characters of HTML text?

1. The code is based on HTMLParser (http://htmlparser.sourceforge.net/)

2. The following is a code.

import org.htmlparser.nodes.TextNode;
import org.htmlparser.beans.StringBean;

...
public String getPlainTextString(String htmlStr)
{
StringBean sb = new StringBean();
sb.visitStringNode(new TextNode(htmlStr));
return sb.getStrings();
}
...

Example)

How I Escaped Jami G& rsquo; Shadow
=>
How I Escaped Jami G’s Shadow

0 개의 댓글: