Please nominate your Qt Champions for 2021!

XMLListModel & [CDATA]

  • @
    <img width="460" height="259" src=""><br/><p>Canadian banks are not overly exposed to worrisome debt from European banks, but if the euro crisis spreads the impact on our economy would be significant, the central bank warned Wednesday.</p>

    XmlListModel {
    property string urlFromItem
    source: urlFromItem
    query: "/rss/channel/item"

    XmlRole { name: "rssTitle"; query: "title/string()" }
    XmlRole { name: "rssDescription"; query: "description/string()" }
    XmlRole { name: "rssPubDate"; query: "pubDate/string()" }



    how can I ignore the [CDATA] and just get the <p> </p>

  • Hi,

    The CDATA wrapper itself should be automatically removed by XmlListModel (i.e. the beginning <![CDATA[ and ending ]]> should be stripped off). The link at the beginning is part of the body of the CDATA, so if you want to remove it you'll need to do so via string manipulation (e.g. rssDescription.substr(rssDescription.indexOf("<p>")) ).


Log in to reply