解析 html 字符串

http://www.open-open.com/jsoup/

 

去除html字符串内的html标签,只留文本:

/**
	 * 解析一个html字符串,只得到此字符串中的文本
	 * @param html
	 * @return
	 */
	public static String html2txt(String html) {
		//测试1
		Document document = Jsoup.parse(html);
		String content = document.text();
        return content;
	}

你可能感兴趣的:(解析 html 字符串)