jsoup: Java HTML Parser

网址:https://jsoup.org/

java解析html

 示例:

        public static String alterImgStyle(String html) {
		Document doc = Jsoup.parse(html);
		Elements imgs = doc.select("img");
		for (Element e : imgs) {
			 e.attr("style","width: 100%;");
		}
		return doc.body().html();//使用body,否则会带有<html>....</html>
	}

 

相关文章: