<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[XmlListModel queries]]></title><description><![CDATA[<p dir="auto">I have such xml in source of XmlListModel</p>
<p dir="auto">@&lt;items&gt;<br />
&lt;playlist_name&gt;PLAYLIST MEGA NAME&lt;/playlist_name&gt;<br />
&lt;channel&gt;<br />
&lt;title&gt;title_1&lt;/title&gt;<br />
&lt;logo&gt;logo_1.jpg/logo&gt;<br />
&lt;description&gt;desctiption_1&lt;/description&gt;<br />
&lt;playlist_url&gt;playlist_1.htm&lt;/playlist_url&gt;<br />
&lt;/channel&gt;<br />
&lt;channel&gt;<br />
&lt;title&gt;title_n&lt;/title&gt;<br />
&lt;logo&gt;logo_n.jpg/logo&gt;<br />
&lt;description&gt;desctiption_n&lt;/description&gt;<br />
&lt;playlist_url&gt;playlist_n.htm&lt;/playlist_url&gt;<br />
....<br />
@</p>
<p dir="auto">and I have qml like</p>
<p dir="auto">@XmlListModel {<br />
source: "<a href="http://example.com/playlists.xml" target="_blank" rel="noopener noreferrer nofollow ugc">http://example.com/playlists.xml</a>"<br />
query: "/items/channel"<br />
XmlRole { name: "logo"; query: "logo/string()" }<br />
XmlRole { name: "title"; query: "title/string()" }<br />
XmlRole { name: "description"; query: "description/string()" }<br />
XmlRole { name: "playlist_url"; query: "playlist_url/string()" }<br />
XmlRole { name: "stream_url"; query: "stream_url/string()" }<br />
}@</p>
<p dir="auto">and I have 2 troubles:</p>
<p dir="auto">how to get access to /items/playlist_name (single-instance-tag) ?</p>
<p dir="auto">I tried</p>
<p dir="auto">XmlRole { name: "playlist_name"; query: "/items/playlist_name/string()" }</p>
<p dir="auto">but this construction failed :-(</p>
<p dir="auto">And I have other xml-srtuct like first but instead of /items/content/playlist_url field named /items/content/stream_url</p>
<p dir="auto">It is possible to describe it with one XmlListModel?<br />
How to detect type of model by presence playlist_url or stream_url?</p>
<p dir="auto">Thx.</p>
]]></description><link>https://forum.qt.io/topic/16490/xmllistmodel-queries</link><generator>RSS for Node</generator><lastBuildDate>Wed, 23 Sep 2026 05:16:35 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/16490.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 05 May 2012 13:53:51 GMT</pubDate><ttl>60</ttl></channel></rss>