Important: Please read the Qt Code of Conduct -

Problem using XmlListModel query to parsing rss xml

  • here is the rss xml :
    -<rss version="2.0">
    <img src="">or, The Ship Wreck; also A Voyage to Norway; and The Fisherman's Cottage. </p><p>Author: Agnes Strickland </p>
    <p>Language: English </p><p>Published: 1851 </p>
    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

    property string currentFeed: ""

    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!

  • Hi,

    Could you please double check your XML file - it contains some mistyped characters as I see it. Also there is opening <p> which is please clean it first a bit and then specifiy exactly what do you expect to grab from the xml as pass it over to the role.

Log in to reply