Android 中的 HTML 解析
我正在尝试学习如何解析 HTML,但由于我在 Java 或 Android 方面没有太多经验,所以有点复杂。我已阅读 IBM XML 解析教程并学会了解析 RSS 提要。我的问题是:我想从 HTML 站点获取数据。我已经阅读了一些有关 HTML 清理器、JSON 等的信息,但我找不到好的教程来帮助我。您有任何可能有用的教程吗?
谢谢。
I am trying to learn how to parse HTML, but as I don't have a lot of experience in either Java or Android, it's a little complicated. I have read the IBM XML parsing tutorial and have learned to parse an RSS feed. My problem is: I would like to get data from an HTML site. I have read some information on HTML cleaner, JSON, etc., but I can't find a good tutorial to help me. Do you have any tutorials that might be helpful?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看以下 HTML 解析器。还有更多。也许有一个适合您:
HTMLCleaner:
http://htmlcleaner.sourceforge.net/
TagSoup:
http://ccil.org/~cowan/XML/tagsoup/
杰里科:
http://jericho.htmlparser.net/docs/index.html
Check out the following HTML parsers. There are more out there. Maybe one will work for you:
HTMLCleaner:
http://htmlcleaner.sourceforge.net/
TagSoup:
http://ccil.org/~cowan/XML/tagsoup/
Jericho:
http://jericho.htmlparser.net/docs/index.html
IMO 有两种简单的方法来解析 HTML:
或者,如果你想编写自己的解析器(我怀疑你应该这样做,作为家庭作业:它会很长)并且正确/完整地实现它很复杂),请参阅解析 HTML 的规范。
IMO there are two easy ways to parse HTML:
Alternatively, if you want to write your own parser (which I doubt you should, for homework: it would be long and complicated to implement it properly/completely), see the specs for parsing HTML.