【问题标题】:light weight HTML Parser for translating to formatted text?用于转换为格式化文本的轻量级 HTML 解析器?
【发布时间】:2009-07-26 13:26:21
【问题描述】:

我正在寻找用于转换为格式化文本的轻量级 HTML 解析器。例如:

<html>
<body>
<a href="http://www.google.com/">Google</a>
<img src="http://images.google.com/intl/en_us/images/logos/images_logo.gif" alt="Google image logo" />
<ol>
<li>first</li>
<li>second</li>
</ol>
<ul>
<li>apple</li>
<li>orange</li>
</ul>
<table><tr><td>cell a</td><td>&nbsp;</td><td>cell b</td></tr><tr><td>cell c</td><td>cell d</td><td>cell e</td></tr><table>

</body>
</html>

进入:

Google (link:http://www.google.com/) (img:Google images logo)

1. first
2. second

- apple
- orange

cell a(tab) (tab)cell b
cell c(tab)cell d(tab)cell e

使用 xml/xslt 库是多余的。

【问题讨论】:

    标签: c++ html text


    【解决方案1】:

    您可以查看开源文本浏览器的源代码(例如 lynx)。

    【讨论】:

      【解决方案2】:

      我最终选择了 htmlcxx 来解决这个问题。它足够轻巧。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2010-09-23
        • 1970-01-01
        • 2012-09-05
        • 2014-12-08
        • 1970-01-01
        • 2011-10-14
        • 1970-01-01
        相关资源
        最近更新 更多