The issue I think is that you only have one <list>
element and then all your <item>
are in the same parent. So your query is looking for each <list>
in your XML (only one) and then it prints only the first <item>
element.
Here is some code changing the XmlRole
and the query
that should work. I put the XML directly into the xml
property to simplify:
XmlListModel {
id: itemmodel
xml: "<list><item>This i want</item><item>This i want2</item></list>"
query: "/list/item"
XmlRole {
name: "item"
query: "string()"
}
}
ListView {
width: 180; height: 300
model: itemmodel
delegate: Rectangle {
height: 40
width: 100
color:"red"
Text {
text: item
}
}
}