Android jsoup多行HTML作为单行返回(无中断返回)
我有一个HTML,我正在努力清理:Android jsoup多行HTML作为单行返回(无中断返回),android,html,newline,jsoup,Android,Html,Newline,Jsoup,我有一个HTML,我正在努力清理: <textarea name="notes" rows="5" cols="60">some notes go here and more including a blank line: and another new line etc etc </textarea> 但它以单行的形式返回,而我想在editText中显示结果,如下所示: some notes go he
<textarea name="notes" rows="5" cols="60">some notes go here
and more including a blank line:
and another new
line
etc
etc
</textarea>
但它以单行的形式返回,而我想在editText中显示结果,如下所示:
some notes go here
and more including a blank line:
and another new
line
etc
etc
试试这个:
Element notes = doc.select("textarea[name=notes]").first();
String notesStr = notes.getWholeText();
getWholeText():获取此文本节点的(未编码)文本,包括原始文本中的任何换行符和空格。您使用的是什么版本的JSoup?用1.7.2测试,我的输出是换行。我也在用1.7.2!典型的发现问题后不久,张贴,我保存所有的HTML到一个文件首先…它是被附加没有行返回!
Element notes = doc.select("textarea[name=notes]").first();
String notesStr = notes.getWholeText();