htmlparse.java~11~

来自「这是我当时为了完成毕设」· JAVA~11~ 代码 · 共 66 行

JAVA~11~
66
字号
package news;/** * <p>Title: 新闻搜索引擎</p> * <p>Description: 毕业设计</p> * <p>Copyright: Copyright (c) 2003</p> * <p>Company: </p> * @author 计算机99630 沈晨 * @version 1.0 */import java.util.Iterator;import java.util.Vector;import com.heaton.bot.HTMLPage;import com.heaton.bot.HTTP;import com.heaton.bot.Link;public class HTMLParse {  HTTP _http = null;  public HTMLParse(HTTP http) {    _http = http;  }  public void start() {    try {      HTMLPage _page = new HTMLPage(_http);      _page.open(_http.getURL(), null);      Vector _links = _page.getLinks();      Index _index = new Index();      Iterator _it = _links.iterator();      while (_it.hasNext()) {        Link _link = (Link) _it.next();        String _herf = input(_link.getHREF().trim());        String _title = input(_link.getPrompt().trim());        //System.out.println("=================================");        //System.out.println("HREF: " + _herf);        //System.out.println("TITLE: " + _title);        //_index.AddNews(_herf,_title);      }      //_index.close();    }    catch (Exception ex) {      System.out.println(ex);    }  }  public static String input(String str) {    String temp = null;    if (str != null) {      try {        temp = new String(str.getBytes("ISO8859_1"));      }      catch (Exception e) {      }    }    return temp;  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?