Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    XMLListModel & [CDATA]

    QML and Qt Quick
    2
    2
    1359
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      Alcatraz last edited by

      @
      <description>
      <![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>

      1 Reply Last reply Reply Quote 0
      • M
        mbrasser last edited by

        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>")) ).

        Regards,
        Michael

        1 Reply Last reply Reply Quote 0
        • First post
          Last post