我如何使用c ++从HTML中提取文本? [英] How can I extract text from HTML using c++?

查看:119
本文介绍了我如何使用c ++从HTML中提取文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



 <$ c 

如何使用c ++解析HTML标记? $ c>< html>< body> examlpe text< / body>< / html>


解决方案

最简单的选择是使用HTML解析库。 libxml2 是一个坚实的开源软件,尽管它在技术上是一个C库。你需要加载你的html,然后通过DOM抽出所有的text()节点。我不知道我会推荐这是您的第一个C ++任务。


How can I parse HTML tags using c++?

eg:

<html><body>examlpe text </body></html>

解决方案

The easiest option would be to use an HTML parsing library. libxml2 is a solid open-source one, although it's technically a C library. You'd need to load your html and then walk through the DOM pulling out all the text() nodes. I don't know that I'd recommend this as your first C++ task.

这篇关于我如何使用c ++从HTML中提取文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆