java jsoup解析html ol li

java jsoup解析html ol li

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import org.jsoup.Jsoup; 
import org.jsoup.nodes.Document; 
import org.jsoup.nodes.Element; 
import org.jsoup.select.Elements; 
   
public class HtmlLiParser { 
    public static void main(String[] args) { 
        String html = "<ol><li>Item 1</li><li>Item 2</li><li>Item 3</li></ol>"
        Document doc = Jsoup.parse(html); 
        Elements olElements = doc.select("ol"); 
        for (Element liElement : olElements) { 
            System.out.println(liElement.text()); 
        
    
}

  

 

1
2
3
Item 1 
Item 2 
Item 3

  

 

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

posted @   西北逍遥  阅读(39)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~
历史上的今天:
2022-04-12 dowhy
2021-04-12 6号笔记本 tensorflow cpu 1.8
2021-04-12 python object_detection/model_lib_tf2_test.py
2021-04-12 6号笔记本 tensorflow cpu object detection api
2021-04-12 python 遍历文件
2020-04-12 IfcRelAssignsToActor
2019-04-12 Visual studio 2017编译 boost
点击右上角即可分享
微信分享提示