什么C / C ++库可用于HTML DOM构建/更改? [英] What C/C++ library to use for HTML DOM building/changing?

查看:80
本文介绍了什么C / C ++库可用于HTML DOM构建/更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用perl模块 HTML :: DOM 链接到CPAN ),用于从HTML代码构建HTML DOM树,然后使用标准DOM的 removeAttribute , removeChild innerHTML createElement 等。

I am using perl module HTML::DOM (link to CPAN) for building HTML DOM tree from HTML code and then changing it using standard DOM's removeAttribute, removeChild, innerHTML, createElement and so on.

但是,我发现它确实非常缓慢,并且吃了太多的内存(无论如何,它完全处于perl中)。因此,我认为将会有一些C / C ++库能够更快,更有效地执行此操作(因为在支持JavaScript的每种浏览器中都会发生这种情况)。

But, I have found out it's really, really slow and eating too much memory (it's fully in perl, anyway). So, I thought that there will be some C/C++ library that does it faster and more efficiently (because it happens in every browser that have JavaScript support).

到目前为止,我还没有发现任何东西。

So far, I have not found anything. Maybe I am searching wrong?

编辑:我会添加。我希望它能像链接的Perl模块一样工作-我的意思是,这样我可以直接使用HTML的 innerHTML className idName ...是可能的,还是我需要使用常规XML解析器然后由我自己编写这些解析器?

edit: I will add. I would like it if it worked similarly to linked Perl module - by that, I really mean so I could use directly HTML's innerHTML, className, idName... Is it posible, or will I need to use general XML parser and then write these by myself?

edit2:好的,Perl模块的缓慢实际上完全是我的错。但是,由于我已经问过,问题仍然存在:)

edit2: OK, the slowness of the Perl module was actually my fault entirely. However, since I already asked, the question still stands :)

推荐答案

libgdome 是一个库,它在 libxml2

许多用于此目的的更快的高级语言模块(例如,在Python世界中, lxml )通常直接在libxml2上构建,自己做DOM位。

Many of the faster higher-level language modules for this purpose (such as, in the Python world, lxml) tend to be built directly on libxml2, doing the DOM bits themselves.

这篇关于什么C / C ++库可用于HTML DOM构建/更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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