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. XmlListModel queries
Qt 6.11 is out! See what's new in the release blog

XmlListModel queries

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.4k 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.
  • V Offline
    V Offline
    vinnitu
    wrote on last edited by
    #1

    I have such xml in source of XmlListModel

    @<items>
    <playlist_name>PLAYLIST MEGA NAME</playlist_name>
    <channel>
    <title>title_1</title>
    <logo>logo_1.jpg/logo>
    <description>desctiption_1</description>
    <playlist_url>playlist_1.htm</playlist_url>
    </channel>
    <channel>
    <title>title_n</title>
    <logo>logo_n.jpg/logo>
    <description>desctiption_n</description>
    <playlist_url>playlist_n.htm</playlist_url>
    ....
    @

    and I have qml like

    @XmlListModel {
    source: "http://example.com/playlists.xml"
    query: "/items/channel"
    XmlRole { name: "logo"; query: "logo/string()" }
    XmlRole { name: "title"; query: "title/string()" }
    XmlRole { name: "description"; query: "description/string()" }
    XmlRole { name: "playlist_url"; query: "playlist_url/string()" }
    XmlRole { name: "stream_url"; query: "stream_url/string()" }
    }@

    and I have 2 troubles:

    how to get access to /items/playlist_name (single-instance-tag) ?

    I tried

    XmlRole { name: "playlist_name"; query: "/items/playlist_name/string()" }

    but this construction failed :-(

    And I have other xml-srtuct like first but instead of /items/content/playlist_url field named /items/content/stream_url

    It is possible to describe it with one XmlListModel?
    How to detect type of model by presence playlist_url or stream_url?

    Thx.

    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