【发布时间】:2023-03-04 23:48:01
【问题描述】:
有许多资源可以解析 HTML 页面和提取文本内容。 Jsoup 就是一个例子。就我而言,我想提取带有每个句子出现的 html 标记的文本内容。以这个页面为例
<html>
<head><title>Test Page</title>
<body>
<h1>This is a test page</h1>
<p> The goal is to extract <b>textual content <em> with html tags</em> </b> from html pages.
</body>
</html>
我希望输出是这样的:
<h1>This is a test page</h1>
<p> The goal is to extract <b>textual content <em> with html tags</em> </b> from html pages.
换句话说,我想在页面的文本内容中包含特定的 html 标签。
【问题讨论】:
标签: html-parsing jsoup text-extraction