jsoup获取指定class名称的标签

 

 

   public void loadHtmlFile(String htmlFilePath) {
        try {
            Document doc = Jsoup.parse(new File(htmlFilePath), "utf-8");
            Elements divs = doc.select("div.hop1");
            for (Element div : divs) {
                System.out.println(div); // 输出: div
            }
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        
    }

 

 

#####################

posted @ 2023-10-14 15:16  西北逍遥  阅读(322)  评论(0)    收藏  举报