QWebKit + XPath + HTML. Is it possible?
Question
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!
Solution
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();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow