Java中如何从HTML文件中获取值?
我需要从 HTML 文件中获取一个值(下面示例中的“abc”),如下所示:
<input type="hidden" name="something" value="abc" />
正如我从其他帖子中发现的那样,我应该使用 HTML 解析器之一(而不是正则表达式)。您能告诉我使用哪一个或显示代码示例吗?
谢谢。
I need to get a value ("abc" in below example) from HTML file that looks like this:
<input type="hidden" name="something" value="abc" />
As i found out from other posts, i should be using one of the HTML parsers (not regex). Could you please tell me which one to use or show a code sample.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 Jsoup 来实现此目的。
或者更短:
另请参阅:
You could use Jsoup for this.
Or shorter:
See also:
看看 http://htmlparser.sourceforge.net/
Have a look at http://htmlparser.sourceforge.net/