Removing HTML entities while preserving line breaks with JSoup

前端 未结 2 587
情书的邮戳
情书的邮戳 2020-12-21 06:34

I have been using JSoup to parse lyrics and it has been great until now, but have run into a problem.

I can use Node.html() to return the full HTML of t

2条回答
  •  隐瞒了意图╮
    2020-12-21 07:04

    (disclaimer) I haven't used this API ... but a quick look at the docs suggests that you could visit each descendent node and dump out its text contents. Breaks could be inserted when special tags like
    are encountered.

    The TextNode.getWholeText() call also looks useful.

提交回复
热议问题