htmlparser下载网页

时间:2016-03-11 09:54:18
【文件属性】:

文件名称:htmlparser下载网页

文件大小:18KB

文件格式:DOCX

更新时间:2016-03-11 09:54:18

htmlparser

import org.htmlparser.Node; import org.htmlparser.NodeFilter; import org.htmlparser.Parser; import org.htmlparser.filters.TagNameFilter; import org.htmlparser.tags.TableTag; import org.htmlparser.util.NodeList; public class TestYahoo { public static void testHtml() { try { String sCurrentLine; String sTotalString; sCurrentLine = ""; sTotalString = ""; java.io.InputStream l_urlStream; java.net.URL l_url = new java.net.URL( "http://sports.sina.com.cn/iframe/nba/live/"); java.net.HttpURLConnection l_connection = (java.net.HttpURLConnection) l_url .openConnection(); l_connection.connect(); l_urlStream = l_connection.getInputStream(); java.io.BufferedReader l_reader = new java.io.BufferedReader( new java.io.InputStreamReader(l_urlStream)); while ((sCurrentLine = l_reader.readLine()) != null) { sTotalString += sCurrentLine; }


网友评论

  • 只是些网页吗?不是想要的包啊。