1.添加jar包
<dependency> <groupId>org.jsoup</groupId> <artifactId>jsoup</artifactId> <version>1.14.3</version> </dependency>
2.测试
public static void main(String[] args) { String html = "<p style=\"text-indent: 21.1pt;\"><strong>1.品种选用。</strong><span style=\"font-family: 宋体;\">选择适合于机械化作业的杂交稻品种﹐根据前作和生态区选择种子发芽率高、生育期偏短、株高适中、穗型中等、分蘖力较强的高产优质品种。</span></p>"; Document document = Jsoup.parseBodyFragment(html); System.out.println(document.text()); }
标签:document,String,jsoup,html,文本,将富 From: https://www.cnblogs.com/zcjyzh/p/17340869.html