Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How can I parsing html in Qt by C++?
Hi; I want to parsing html in Qt by C++. I will develop html parser for desktop and mobile application. Which can I use C++ module for html parser? Thanks.
What kind of parsing do you have in mind ?
@SGaist Example: <html><body><a href="www.xxx.yyy">Click Me!</a></body></html>
I want to get www.xxx.yyy and Click Me!. How can I do that?
There's the QWebElement class that could be of use but it's in the deprecated QtWebKit module.
But are you looking for a library to do the parsing or write your own ?
@SGaist I looked some html parser library. There is not a library or module in Qt 5.5.1 or Qt 5.6? Else should I use a html parser library or write my own library by QRegExp?
If you know in advance the html you want to parse and that it fits in the xml category you can use the QXmlStreamReader class. For example, you html snippet should be parsed without any problem.
If you want to use regular expressions go with QRegularExpression.
Again, it depends on what exactly you need. If it's to parse any and every html page then you should consider a dedicated library.