HTML文檔解析器 HTMLParser

jopen 13年前發布 | 20K 次閱讀 Java HTML操作類庫

htmlparserlogo.jpg
HTML Parser 是一個對HTML進行分析的快速實時的解析器,最新的發行版本是1.6,另外2.0的開發版本已經兩年沒有進展了。利用它實現:

  • URL rewriting, modifying some or all links on a page
  • site capture, moving content from the web to local disk
  • censorship, removing offending words and phrases from pages
  • HTML cleanup, correcting erroneous pages
  • ad removal, excising URLs referencing advertising
  • conversion to XML, moving existing web pages to XML

示例代碼:

 Parser parser = new Parser ("http://whatever");
 NodeList list = parser.parse (null);
 Node node = list.elementAt (0);
 NodeList sublist = node.getChildren ();
 System.out.println (sublist.size ());

項目主頁:http://www.baiduhome.net/lib/view/home/1324372600983

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!