I. jsoup (I am not familiar with this class library due to direct first push)
English document: http://www.open-open.com/jsoup/parsing-a-document.htm
Jsoup use: http://www.iteye.com/topic/1010581
The simplest and practical: http://hongmin118.iteye.com/blog/1229705
/*** Parse an HTML string and get only the text in this string * @ Param HTML * @ return */public static string html2txt (string HTML) {// <span style = "color: RGB (229, 51, 51); background-color: RGB (0,153, 0); font-weight: bold; font-style: italic; text-Decoration: underline; "> Test 1 </span> document = jsoup. parse (HTML); string content = document. text (); Return content ;}
Your own code:
// Read all the text in HTML, without tags // data can be incomplete HTML page data document DOC = jsoup. parse (data); text = Doc. text (); // obtain all image tags media = Doc. select ("IMG [SRC]"); // obtain the link of the tag string imgurl = SRC. ATTR ("ABS: SRC ");
Ii. htmlparser
Use: http://free0007.iteye.com/blog/1131163