XMLListModel & [CDATA]

  • @
    <img width="460" height="259" src="http://www.cbc.ca/gfx/images/news/topstories/2012/05/22/hi-mark-carney-6col.jpg"><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

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.