Html Parsing with QtWebEngine
-
wrote on 21 Sept 2017, 12:34 last edited by
If the site use XHTML you can use the XML classes to achieve what you want.
-
If the site use XHTML you can use the XML classes to achieve what you want.
wrote on 21 Sept 2017, 13:55 last edited by@JohanSolo thank you for your answer. The document type of the web site is HTML. There is a library QXMLStreamReader to read XML files but I think this is not the library I need.
-
@JohanSolo thank you for your answer. The document type of the web site is HTML. There is a library QXMLStreamReader to read XML files but I think this is not the library I need.
wrote on 21 Sept 2017, 14:03 last edited by@aysenur Sorry but for non XHTML I have no idea. Maybe in the QtWebEngine module you can find something...
-
wrote on 27 Sept 2017, 08:07 last edited by
Hello,
QNetworkAccessManager, QNetworkRequest, QNetworkReply libraries can be used for getting the content of a web page as I have seen from the web. By the help of them I could get the source of the web page into a QString object. But I want to get the button of a web page into my application. (May be this can be similar to parse the title of a web page from the source and show it on the app) How can I parse the source according to tag names? Thank you in advance. -
Hello,
QNetworkAccessManager, QNetworkRequest, QNetworkReply libraries can be used for getting the content of a web page as I have seen from the web. By the help of them I could get the source of the web page into a QString object. But I want to get the button of a web page into my application. (May be this can be similar to parse the title of a web page from the source and show it on the app) How can I parse the source according to tag names? Thank you in advance.wrote on 27 Sept 2017, 09:21 last edited by@aysenur
Parsing HTML (not XHTML) is notoriously difficult. There is not a built-in Qt offering.However, see the discussion and posted answer at https://forum.qt.io/topic/74485/is-there-a-clear-way-to-parse-html-in-qt-5-7/14. It appears there is a
QGumboParser
(https://github.com/lagner/QGumboParser) which someone is reporting success with under Qt.Otherwise, you'll have to see whether your particular use case can be addressed to your limited satisfaction via Regular Expression parsing from Qt.
1/6