Java : HTML Parsing

后端 未结 4 971
一个人的身影
一个人的身影 2020-12-22 05:23

I am having HTML contents as given below. The tag that i am looking out for here are \"img src\" and \"!important\". Does Java provide any HTML par

4条回答
  •  一向
    一向 (楼主)
    2020-12-22 05:49

    String value = Jsoup.parse(new File("d:\\1.html"), "UTF-8").select("img").attr("src");
    System.out.println(value); //http://socialimg04.rediff.com/image.php?uid=32868898&type=thumb
    System.out.println(Jsoup.parse(new File("d:\\1.html"), "UTF-8").select("span[style$=important;]").first().text());//android se updates...
    
    • JSoup
    • What-are-the-pros-and-cons-of-the-leading-java-html-parsers

提交回复
热议问题