RSS and QML
-
Hi,
I'm trying to make a RSS reader using QtQuick, so I start with the RSS exemple from QtCreator.
I have 2 problems:- I what to read the content of "content:encoded" from the RSS file , so I added here:
@XmlListModel {
id: feedModel
source: "http://" + window.currentFeed
query: "/rss/channel/item"XmlRole { name: "title"; query: "title/string()" } XmlRole { name: "link"; query: "link/string()" } XmlRole { name: "description"; query: "description/string()" } XmlRole { name: "encodedContent"; query: "content:encoded/string()" } }@
but it dont works with this error :
@QML XmlRole: invalid query: "content:encoded/string()"@- do you have any idea why the RSS exemple dont works with any RSS files from wordpress.com
for exemple this one :
@ListElement { name: "L"; feed: "blackwolf12333.wordpress.com/feed/" }@
if you have any recommendations about RSS and QML you are welcome...
thank you. -
I have the same problem.
What I see is thas wordpress creates the next feed:
@
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"><channel>
<title>Spooky Null</title>
<atom:link href="http://blackwolf12333.wordpress.com/feed/" rel="self" type="application/rss+xml" />
<link>http://blackwolf12333.wordpress.com</link>
<description>Development Blog by blackwolf12333</description>
<lastBuildDate>Thu, 09 Oct 2014 21:13:13 +0000</lastBuildDate>
<language>nl</language>
sy:updatePeriodhourly</sy:updatePeriod>
sy:updateFrequency1</sy:updateFrequency>
<generator>http://wordpress.com/</generator>
<cloud domain='blackwolf12333.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
<url>http://s2.wp.com/i/buttonw-com.png</url>
<title>Spooky Null</title>
<link>http://blackwolf12333.wordpress.com</link>
</image>
<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blackwolf12333.wordpress.com/osd.xml" title="Spooky Null" />
<atom:link rel='hub' href='http://blackwolf12333.wordpress.com/?pushpress=hub'/>
<item>
<title>Finally an update</title>
<link>http://blackwolf12333.wordpress.com/2014/08/21/finally-an-update/</link>
<comments>http://blackwolf12333.wordpress.com/2014/08/21/finally-an-update/#comments</comments>
<pubDate>Thu, 21 Aug 2014 19:12:43 +0000</pubDate>
dc:creator<![CDATA[blackwolf12333]]></dc:creator>
<category><![CDATA[Programming]]></category>
<category><![CDATA[game]]></category>
<category><![CDATA[game development]]></category>
<category><![CDATA[indie game development]]></category>
<category><![CDATA[school project]]></category>
<category><![CDATA[spritekit]]></category>
<category><![CDATA[xcode]]></category><guid isPermaLink="false">http://blackwolf12333.wordpress.com/?p=63</guid>
<description>......</description>
content:encoded...</content:encoded>
wfw:commentRsshttp://blackwolf12333.wordpress.com/2014/08/21/finally-an-update/feed/</wfw:commentRss>
slash:comments0</slash:comments><media:content url="http://2.gravatar.com/avatar/54d689ce9b12c3da69e69bcbb91319d4?s=96&d=identicon&r=G" medium="image">
<media:title type="html">blackwolf12333</media:title>
</media:content>
</item>
@I have tried to use
@ query: "/channel/item" @
instead of
@ query: "/rss/channel/item" @
but can't get with the solution. I'm using all the namespaces in
@
XmlListModel {
id: feedModel
source: "http://" + window.currentFeed
query: "/rss/channel/item"
namespace: "declare namespace content = 'http://purl.org/rss/1.0/modules/content/';declare namespace wfw = 'http://wellformedweb.org/CommentAPI/';declare namespace dc = 'http://purl.org/dc/elements/1.1/';declare namespace atom = 'http://www.w3.org/2005/Atom';declare namespace sy = 'http://purl.org/rss/1.0/modules/syndication/';declare namespace slash = 'http://purl.org/rss/1.0/modules/slash/';declare namespace georss = 'http://www.georss.org/georss';declare namespace geo = 'http://www.w3.org/2003/01/geo/wgs84_pos#';declare namespace media = 'http://search.yahoo.com/mrss/';"XmlRole { name: "title"; query: "title/string()" } XmlRole { name: "link"; query: "link/string()" } XmlRole { name: "description"; query: "description/string()" } XmlRole { name: "encodedContent"; query: "content:encoded/string()" } }
@
-
Hi,
Did you try to get access to 'content:encode' like 'content' or 'encoded'?
I've the same problem when use QXmlInputSource and QDom* in C++ code. When I receive parsed datas and try to use it I receive 'content' field not 'content:encode'. I don't is this bug or this is right. Try to use content field.
The problem when you RSS has a to field like in this rss http://blog.qt.digia.com/feed/ :
@
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">
<channel>
<title>Qt Blog</title>
<atom:link href="http://blog.qt.digia.com/feed/" rel="self" type="application/rss+xml"/>
<link>http://blog.qt.digia.com</link>
<description>For Developers by Developers</description>
<lastBuildDate>Fri, 17 Oct 2014 09:21:55 +0000</lastBuildDate>
<language>en-US</language>
sy:updatePeriodhourly</sy:updatePeriod>
sy:updateFrequency1</sy:updateFrequency>
<generator>http://wordpress.org/?v=3.6.1</generator>
<item>
<title>Qt 5.4 Beta Available</title>
<link>
http://blog.qt.digia.com/blog/2014/10/17/qt-5-4-beta-available/?utm_source=rss&utm_medium=rss&utm_campaign=qt-5-4-beta-available
</link>
<comments>
http://blog.qt.digia.com/blog/2014/10/17/qt-5-4-beta-available/#comments
</comments>
<pubDate>Fri, 17 Oct 2014 09:00:21 +0000</pubDate>
dc:creatorTuukka Turunen</dc:creator>
<category>
<![CDATA[ Licensing ]]>
</category>
<category>
<![CDATA[ Qt ]]>
</category>
<category>
<![CDATA[ Releases ]]>
</category>
<guid isPermaLink="false">http://blog.qt.digia.com/?p=40509</guid>
<description>
</description>
content:encoded...</content:encoded>
wfw:commentRss //get like commentRss
http://blog.qt.digia.com/blog/2014/10/17/qt-5-4-beta-available/feed/
</wfw:commentRss>
slash:comments14</slash:comments> //get like comments
</item>
@