문제

Is it possible to parse HTML (HTML/HTML5, not XHTML) pages using XPath and Qt classes of QWebkit (and probably other standard or Qt classes) without using any external utilities like tidy?

Thanks a lot!

도움이 되었습니까?

해결책

No, obviously. XPath is for well-formed XML, which HTML is not (besides XHTML that you specifically excluded).

For accessing the DOM tree of a QtWebkit page, you have to use QtWebkit's QWebElement api.

You can access the document element with

QWebElement QWebView::page()->mainFrame()->documentElement();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top