3 ms·
Funny story on that. For the Arora browser for a while I was pondering the best way to make a tool to import html bookmarks. I went a handful of different rou
by icefox 18y ago
Funny story on that. For the Arora browser for a while I was pondering the best way to make a tool to import html bookmarks. I went a handful of different routes, but none of them were that good (I could import all my test data, but I wasn't sure I could input all users data) because of all the different html bookmark files that people generate, but I had an epiphany. I had at my fingertips webkit. So rather then trying to reinvent a bad html parser I just would just let webkit parse it and walk it with javascript.
The code ended up being something like
QWebView view;
view.load("file://local/file/foo.html");
print view.mainFrame()->evaluateJavaScript(javascriptCode);
Full source here: http://github.com/Arora/arora/tree/master/tools/htmlToXBel http://github.com/Arora/arora/tree/master/tools/htmlToXBel
With QtWebKit working on all platforms and having a really nice api making things like this is a snap and easy to do.