×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Apr 2008
    Location
    India / Singapore
    Posts
    549

    Problem with XMLListModel

    I am pretty much a newbie to QML and have been experimenting just recently..
    The following is a code that was working well, but in incremental devlpt I made some mistake and I am unable to recover proper functioning.. The code below pulls data from a RSS feed and displays title and publication Date..


    Code:
    import QtQuick 1.0
    
    Rectangle {
       width : 600
       height: 400
       color : "lightgrey"
    
            XmlListModel {
           id: xmlModel
           source: "http://www.ted.com/talks/rss"
           query: "/rss/channel/item"
    
           namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';"
    
           XmlRole { name: "title"; query: "title/string()" }
           XmlRole { name: "pubDate"; query: "pubDate/string()" }
    
      }
            Component {
                id: listDelegate
                Item {
                    width: parent.width
                    height: 55
                    Column {
                      id:columnID
                        x : 65
                        Text { text: title
                               font.pointSize: 12
                            }
                        Text { text:  pubDate
                            color:  "grey"
                            font.pointSize: 8
                            font.italic: true
    
                        }
                    }
                }
            }
            ListView {
             y: 10
             width: parent.width
             height: parent.height - 10
             model: xmlModel
             delegate: listDelegate
             highlight: Rectangle { color: "darkgrey"; radius: 5; width: parent.width }
             focus: true
             clip: true
    
             }
    
    }

    I am unable to say why the code is not working. I seem to have connected the ListView with a model on delegate. Can you please tell me what is wrong..
    Also, how do i track status / error codes of the web service I am making. I would prefer having a spinning wheel animation until the load is successful
    Twitter - manikantan_k
    Just in --

  2. #2
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: Problem with XMLListModel

    Hi,
    the error is pretty simple. The query you used to create the items doesn't match the RSS feed you are fetching.
    Please, check http://doc.qt.nokia.com/4.7-snapshot...listmodel.html for the correct usage of the query property.

  3. #3
    Registered User
    Join Date
    Apr 2008
    Location
    India / Singapore
    Posts
    549

    Re: Problem with XMLListModel

    I put out the RSS Feed in a XML Tree structure and dont see the mistake in hierarchy.
    I also changed the source to something more simpler(standard RSS) like
    http://rss.news.yahoo.com/rss/topstories

    Yet I was not getting any results back.. Could you pls correct me in the place where I am wrong..
    Twitter - manikantan_k
    Just in --

  4. #4
    Registered User
    Join Date
    Apr 2008
    Location
    India / Singapore
    Posts
    549

    Re: Problem with XMLListModel

    Solved it.. Thanks..
    it was the namespaces.. removing it solved..
    Twitter - manikantan_k
    Just in --

Similar Threads

  1. Problem with saving and retrieving text with the RMS
    By Radst3r in forum Mobile Java General
    Replies: 2
    Last Post: 2010-04-28, 11:23
  2. connectivity problem with 6020... whats with this COM thing?
    By vasudha202 in forum PC Suite API and PC Connectivity SDK
    Replies: 0
    Last Post: 2007-09-03, 14:04
  3. Replies: 2
    Last Post: 2003-09-03, 14:47
  4. problem with java client with GSM modem ( USB port )
    By sutham in forum General Messaging
    Replies: 1
    Last Post: 2003-02-12, 06:24
  5. Nokia 22 problem with incoming calls with extension mode B
    By meross in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2002-10-11, 09:32

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×