Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved] Read different Feeds
Forum Updated to NodeBB v4.3 + New Features

[Solved] Read different Feeds

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 3.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lynardo
    wrote on 7 Feb 2011, 18:29 last edited by
    #1

    Hi Pros there,

    in my project YANET (Yet another News Ticker) I´ll try to access any different kind of News Feed to the Rss Reader Demo of Qt Quick but when try to read another Feed verion out of Rss2 like Atom or Rdf there is nothing to see. Here is what I´m coded:

    @
    ...
    XmlListModel {
    function check() {
    if(feedModel.count == 0)
    {
    console.log("No Xml Data found, try new Feed Model");
    if(feedModel.query == "/rdf:RDF/item")
    console.log("Can´t find any kind of known Rss Data");
    else if(feedModel == "/feed/entry")
    {
    feedModel.query = "/rdf:RDF/item";
    console.log("Test Rdf Model");
    }
    else if(feedModel.query == "/rss/channel/item")
    {
    feedModel.query = "/feed/entry";
    console.log("Test Atom Model");
    }
    }
    }
    id: feedModel
    source: "http://" + window.currentFeed
    query: "/rss/channel/item"

        XmlRole { name: "title"; query: "title/string()" }
        XmlRole { name: "link"; query: "link/string()" }
        XmlRole { name: "description"; query: "description/string()" }
    
        onStatusChanged: {
            console.log(errorString());
            if(status == XmlListModel.Ready)
            {
                check();
                reload();}
        }
    }
    

    ...
    @

    I added one line in CategoryDelegate to reset the feedModel.query line to "/rss/channel/item"

    So now to my problem: If I try to read as example these atom feed: "heise.de/newsticker/heise-atom.xml":http://www.heise.de/newsticker/heise-atom.xml

    I can´t see anything displayed, but the console log tells me that the feedModel.query string was changed!

    Please help me

    lynardo

    What a nice world it could be if we all had Google...
    Oh, Yes I remeber, we all had Google

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lynardo
      wrote on 7 Feb 2011, 18:59 last edited by
      #2

      Well I have a little bit experimented now, and found out that as far as I can see, it doesn´t work, because in the example feed there is this line: feed xmlns="http://www.w3.org/2005/Atom"
      (I had to cut out the < and > because it wouldn´t be shown other way)
      and if I cut out the attribute, that the line looks like this: <feed>
      then it works. Although in "this":http://rss.chip.de/c/573/f/7439/index.rss Rss2 Feed it works with many of these attributes, does anyone know why??

      Really thank you!

      lynardo

      What a nice world it could be if we all had Google...
      Oh, Yes I remeber, we all had Google

      1 Reply Last reply
      0
      • H Offline
        H Offline
        hartti
        wrote on 8 Feb 2011, 00:47 last edited by
        #3

        There seems to a property namespaceDeclarations which you need to set in the XmlListModel in this case. For Atom that is

        @namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';"@

        Hartti

        1 Reply Last reply
        0
        • H Offline
          H Offline
          hartti
          wrote on 8 Feb 2011, 00:48 last edited by
          #4

          Forgot to add the url for the documentation about this
          http://doc.qt.nokia.com/4.7/qml-xmllistmodel.html#namespaceDeclarations-prop

          Hartti

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lynardo
            wrote on 8 Feb 2011, 12:59 last edited by
            #5

            Hey really thousand thanks to you, it seems like I had overred that peace of information from the doc. Problem solved, it works great now!

            What a nice world it could be if we all had Google...
            Oh, Yes I remeber, we all had Google

            1 Reply Last reply
            0

            1/5

            7 Feb 2011, 18:29

            • Login

            • Login or register to search.
            1 out of 5
            • First post
              1/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved