Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. XMLListModel & [CDATA]

XMLListModel & [CDATA]

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 1.5k Views
  • 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 Offline
    A Offline
    Alcatraz
    wrote on last edited by
    #1

    @
    <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
    0
    • M Offline
      M Offline
      mbrasser
      wrote on last edited by
      #2

      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
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved