Replace HTML tags using jsoup

后端 未结 1 1265
不思量自难忘°
不思量自难忘° 2021-02-14 00:49

Here is my code

String html = \"fsdfsdfsdfdasdasd\";
Document doc = Jsoup.parse(html);
Elements elements = doc.         


        
1条回答
  •  暖寄归人
    2021-02-14 01:22

    You can replace the Tag like this too:

    String html = "fsdfsdfsdfdasdasd";
    Document doc = Jsoup.parse(html);
    Elements elements = doc.select("font");
    
    
    // rename all 'font'-tags to 'span'-tags, will also keep attributs etc.
    elements.tagName("span");
    
    System.out.println(doc.html());
    

    0 讨论(0)
提交回复
热议问题