Android 解析 HTML

推荐使用jsoup,可能parseHtml对android支持的不是很好;

http://jsoup.org/

Demo:

	public static void main(String[] args) throws IOException {
		String url = "http://www.xxx.com/";
		Document doc = Jsoup.connect(url).get();
		Elements elements = doc.getElementsByTag("img");
		int max = elements.size();
		for(int a=0;a<max;a++){
			Element ment = elements.get(a);
			String fileName = ment.attr("src");
			String fileType = fileName.substring(fileName.lastIndexOf("."));
			System.out.println(ment.attr("src")+"\t"+fileType);
		}
	}

猜你喜欢

转载自sants.iteye.com/blog/1591658