Saturday, September 7, 2013

parse HTML with c++/Qt?

parse HTML with c++/Qt?

How can i parse this HTML
<body>
<span style="font-size:11px">12345</span>
<a>Hello<a>
</body>
i'd like to retrive the data "12345" from a "span" with
style="font-size:11px" from WWW.testtest.com.
i try :
QWebView* m_view;
m_view = new QWebView();
connect(m_view, SIGNAL(loadFinished(bool)),this, SLOT(replyFinished(bool)));
QWebElementCollection elements =
m_view->page()->mainFrame()->findAllElements("span");
foreach (QWebElement e, elements) {
// Process element e
}
but I only want the data not all the other stuff
how can I accomplish this?

No comments:

Post a Comment