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 - XmlRole ( Navigating to parent item)
Forum Updated to NodeBB v4.3 + New Features

XmlListModel - XmlRole ( Navigating to parent item)

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 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.
  • G Offline
    G Offline
    geronik
    wrote on last edited by
    #1

    Hello,

    I have an xml file like this :

    @
    <root>
    <a>
    <b>Text of b</b>
    <c prop="1"/>
    </a>
    <a>
    <b>Another text of b</b>
    <c prop="2--"/>
    </a>
    </root>
    @

    and have created an XmlListModel like this :

    @
    XmlListModel{
    source : "name.xml"
    query : "/a/c[prop = 1]"
    XmlRole{ name: "name" query:"../b/string()" }
    }
    @

    Although the query is executed successfully, I cannot get the values of a parent item.
    Any ideas?

    [EDIT: code formatting, Volker]

    1 Reply Last reply
    0
    • G Offline
      G Offline
      geronik
      wrote on last edited by
      #2

      Ok this works for me now :

      @
      XmlListModel{
      source : "name.xml"
      query : "/a[c[prop = 1]]"
      XmlRole{ name: "name"; query:"b/string()" }
      }
      @

      1 Reply Last reply
      0
      • H Offline
        H Offline
        hartti
        wrote on last edited by
        #3

        Cool, thanks! I was trying to solve the same problem myself.

        Hartti

        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