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. XmlRole with Flickr API
Forum Updated to NodeBB v4.3 + New Features

XmlRole with Flickr API

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 3 Posters 2.8k 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.
  • S Offline
    S Offline
    strekazoid
    wrote on last edited by
    #1

    Trying to use QML with Flickr API calls.

    The thing is that, for example, flickr.photosets.getPhotos call returns a weird looking XML, which looks pretty differently from RSS feed. Here it is:

    <rsp stat="ok">
    <photoset id="72157625173285745" primary="5140502686" owner="23802687@N06" ownername="Alexander Savin" page="1" per_page="500" perpage="500" pages="1" total="38">
    <photo id="5140502686" secret="0ee829b415" server="1190" farm="2" title="Vintage photography from the attic" isprimary="1"/>
    <photo id="5140505054" secret="faaeb624bb" server="4005" farm="5" title="Vintage photography from the attic" isprimary="0"/>

    ..and so on.

    The thing I'm trying is to parse owner value from this XML (which is "23802687@N06" in this case). Is it possible to do with XmlListModel and XmlRole? Or how this should be done in a proper way? Some JavaScript maybe?

    Thanks!

    1 Reply Last reply
    0
    • B Offline
      B Offline
      blam
      wrote on last edited by
      #2

      Yes, assuming your XmlListModel query is "/rsp/photoset" then an XmlRole query value of "@owner/string()" would fetch the owner value. The "@" indicates you are fetching an attribute value. See http://doc.qt.nokia.com/4.7-snapshot/qml-xmlrole.html for more info.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        strekazoid
        wrote on last edited by
        #3

        Thanks, that should do!

        1 Reply Last reply
        0
        • R Offline
          R Offline
          ravirdv
          wrote on last edited by
          #4

          is there any way to filter data (XQuery), lets say i want all the images where id starts with "7" or where owner name is "abc"

          1 Reply Last reply
          0
          • B Offline
            B Offline
            blam
            wrote on last edited by
            #5

            No, not at the moment. Currently xquery statements can only be used for modifying individual data values, rather than the data model itself.

            1 Reply Last reply
            0

            • Login

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