Results 1 to 12 of 12

Thread: Parse RSS into html and display it in QWebView.

  1. #1
    Join Date
    Mar 2010
    Posts
    34
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Parse RSS into html and display it in QWebView.

    Hi!

    I need to make a simple function who parse the xml/rss feed and show it as HTML in QWebView.

    Can anyone tell/help me how?

  2. #2
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: Parse RSS into html and display it in QWebView.

    You can look at numbat's RSS Reader in this thread.

  3. #3
    Join Date
    Mar 2010
    Posts
    34
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Parse RSS into html and display it in QWebView.

    I ask how do it simple, and the rss reader you linked to does not work.

    Can you please tell me how do it simple

    halvors.

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Parse RSS into html and display it in QWebView.

    Quote Originally Posted by halvors View Post
    I ask how do it simple
    What is your definition of simple?
    Do you understand that some things take effort? Me too, I want to have things for free and as fast as possible. Unfortunatly, this is not always possible.
    Don't expect to find everything you need. Sometimes you need to create things yourself. This is what separates intelligent beings from lower lifeforms.

    Suggestion:
    Learn how to use google (or any other search engine)
    Search for rss to html converters or libraries.
    Learn how to include 3rd pary libraries into your program, or how to use processes
    Learn the api of that library, or how to communicate with another process.

    You see, only the sun shines for free. You do need to make a little bit of effort, especially when you ask for help.

    and the rss reader you linked to does not work.
    That might very well be, but hey, you have the source code. Use it to your advantage.

  5. #5
    Join Date
    Mar 2010
    Posts
    34
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Parse RSS into html and display it in QWebView.

    Seem like you dont understand my question, i need to get this exemple: http://doc.qt.nokia.com/4.6/xml-rsslisting.html to parse into webView, i ask how?

  6. #6
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Parse RSS into html and display it in QWebView.

    One way would be to take the output from rsslisting and generate a html page, then use webview to view that page.

  7. #7
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Parse RSS into html and display it in QWebView.

    Quote Originally Posted by halvors View Post
    Seem like you dont understand my question, i need to get this exemple: http://doc.qt.nokia.com/4.6/xml-rsslisting.html to parse into webView, i ask how?
    Sorry, you are right, I could not get that question from your previous posts.
    Suggestion: next time ask exactly what you want please.

  8. #8
    Join Date
    Aug 2007
    Posts
    166
    Thanks
    16
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Parse RSS into html and display it in QWebView.

    Lol you are unbelievable! You have the source code and still you don't know how to display the HTML page that the XML is pointing to? I guess that you even haven't give a little effort to understand how the example works. Anyway here is my hint:

    Take a look at the parseXml() method, you will see the line "if (xml.name() == "item")" that is adding items with the URL to the QTreeWidget, just use this URLs to put them in QWebView and make it load them. It is that simple...

    Now I see that it is even easier, there is itemActivated(QTreeWidgetItem * item) slot that open the URL in external browser, you can add your code there to open it in QWebView.
    Last edited by The Storm; 14th August 2010 at 13:30.

  9. #9
    Join Date
    Mar 2010
    Posts
    34
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Parse RSS into html and display it in QWebView.

    Can you paste an simple exemple? I don't exactly know how...

  10. #10
    Join Date
    Aug 2007
    Posts
    166
    Thanks
    16
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Parse RSS into html and display it in QWebView.

    Are you sure you know how to program ? I really don't know how to put it simple, but here's your example:

    Qt Code:
    1. void RSSListing::itemActivated(QTreeWidgetItem * item)
    2. {
    3. QWebView* webview = new QWebView( this );
    4. webview->setWindowFlags( Qt::Window );
    5. webview->load( QUrl(item->text(1)) );
    6.  
    7. //QDesktopServices::openUrl(QUrl(item->text(1)));
    8. }
    To copy to clipboard, switch view to plain text mode 

    Now when you double click on item, it will open a QWebView window with the page you are looking for.

  11. #11
    Join Date
    Mar 2010
    Posts
    34
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Parse RSS into html and display it in QWebView.

    No im mean make it like firefox.

  12. #12
    Join Date
    Aug 2007
    Posts
    166
    Thanks
    16
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Parse RSS into html and display it in QWebView.

    Just wrap up the XML data in your custom HTML code, you can do that while parsing the RSS in parseXml(), and using some QString to put all the things togeder, then just grab that QString and show it in QWebView. Just add some check for the description too like:

    if (currentTag == "description")

    and voala, you have all the data you need, now you have to wrap it up in HTML tags. If you understand how to code HTML it should not be big deal.

Similar Threads

  1. Html page Display in QWebView
    By Tavit in forum Qt Programming
    Replies: 4
    Last Post: 10th July 2010, 16:39
  2. Reg QWebview Display
    By Tavit in forum Qt Programming
    Replies: 0
    Last Post: 5th August 2009, 16:19
  3. How to save a Qwebview as an html file
    By richardander in forum Qt Programming
    Replies: 2
    Last Post: 5th June 2009, 01:07
  4. Best way to load and parse an HTML file ??
    By tuthmosis in forum Qt Programming
    Replies: 8
    Last Post: 23rd August 2008, 12:06
  5. Display '<' as HTML in QString
    By mclark in forum Qt Programming
    Replies: 4
    Last Post: 6th July 2007, 22:43

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.