我有这个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>
因为他们在textarea中没有brs或\ n。我可以很容易地得到全文:
Element notes = doc.select("textarea[name=notes]").first();
String notesStr = notes.text();
但是我将它作为单行返回,而我想在editText中显示结果,如下所示:
some notes go here
and more including a blank line:
and another new
line
etc
etc
答案 0 :(得分:0)
试试这个:
Element notes = doc.select("textarea[name=notes]").first();
String notesStr = notes.getWholeText();
getWholeText():获取此文本节点的(未编码)文本,包括原始文件中存在的任何换行符和空格。