mercredi 11 août 2010

QWebElement is great!

I recently used the Qt API to access the DOM of a web page through QtWebkit. I just hesitated to use it or to use the JQuery (via evaluateJS)

Probably the JS solution would be more extensible (plugins etc), however the additional work to export the data would be also largely more than expected... and one question also came about it. What if the page (that I want to grab information) already has JQuery (different version, when the evaluate happens etc)?

so I went ahead with the QWebElement object... and it is really powerful, easy to use and the CSS 3 syntax is a must. Purely great :-)

QWebElementCollection allTitles = document.findAll("*.title");
foreach( QWebElement e, allTitles ) {
....

a good link to read about it is from the Qt Labs
http://labs.trolltech.com/blogs/2009/04/17/jquery-and-qwebelement/

Aucun commentaire:

Enregistrer un commentaire