0

我需要通过webkitgtk获取HTML页面的DOM树,但是我不熟悉。你知道关键功能或任何其他有用的信息吗?由于源码中可能包含JS代码,所以这类页面的struct会在页面加载时发生变化,比如javascript的onload函数。我想要的是渲染的 DOM 树。

4

1 回答 1

0

您可以使用DOM-Api来完成此操作:

WebKitDOMDocument* doc = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (web_view));
WebKitDOMElement* root = webkit_dom_document_query_selector (doc, ":root", NULL);
const gchar* content = webkit_dom_html_element_get_outer_html (WEBKIT_DOM_HTML_ELEMENT (root));
于 2013-11-22T18:00:04.513 回答