【发布时间】:2016-12-11 12:36:31
【问题描述】:
我正在尝试使用 jsoup 解析 html 文本。例如,我在 html 中有以下行。
<p align='left'><font size='12.0pt'><u><i><b>A bold italic underlined text: <br><br></b></i></u></font><font size='12.0pt'><i><b> </b></i></font><font size='9.0pt'><i> </i></font><font size='9.0pt'><b>This is only Bold </i></font><font size='9.0pt'><i> </i></font><font size='9.0pt'><i><b> <br><br> </b></i></font><font size='9.0pt'>this is a simple line with white spaces at the end and at the beginnig </font></p>
如何提取带有粗体、下划线和字体大小等格式信息的文本...
我尝试遍历所有元素并找到TextNodes,没有成功。
提前致谢
【问题讨论】:
-
你想要
<p…>…</p>的内容吗? -
我可以通过document.text()获取
…
的内容。我想要的是获取文本的所有格式信息,例如这部分....粗斜体下划线文本:   ;
标签: jsoup