PDA

View Full Version : problem using XmlListModel query to parsing rss xml



xiazhouquan
19th June 2011, 06:20
here is the rss xml :


-<rss version="2.0">
-<channel>
-<item>
-<description>
">or, The Ship Wreck; also A Voyage to Norway; and The Fisherman<p>Author: Agnes Strickland </p>
<p>Language: English </p><p>Published: 1851 </p>
-</description>
-</item>
-</channel>
-</rss>


now I want to get the content of <p>

but in the XmlListModel{},the query role is “/rss/channel/item”,I can not using /rss/channel/item/description to get <p>

here is my code :


import QtQuick 1.0

XmlListModel{
id:feedModel
property string currentFeed: "http://www.manybooks.net/rss/ADV.xml"

source: currentFeed
query: "/rss/channel/item"
XmlRole { name: "title"; query: "title/string()" }
XmlRole { name: "pubDate"; query: "pubDate/string()" }
XmlRole { name: "cover"; query: "description/string()" }
}

How can I get <p> in <description> Thank you very much!

Plaese forgive my poor English!

thanks again!

wysota
19th June 2011, 10:22
The text you posted is not a valid xml because of the ">or" part.