无法验证用XML编写的RSS提要数据('content:encoded'标签无法识别)

时间:2016-04-26 22:39:23

标签: xml validation rss rss-reader

我最近设置了自己的博客,正在为博客撰写RSS源。一旦我得到正确的规则,我打算制作一个脚本为我做,但是现在,我在验证XML时遇到了错误。

RSS Feed是here

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="/res/preview.xsl"?>
<rss version="2.0">
  <channel>
    <title>Tuesday's Gone-bholagabbar</title>
    <link>http://shreyans-sheth.me/blog/gsoc/home.html</link>
    <description><![CDATA[This is bholgabbar's blog, 'Tuesday's Gone'. I (intend to) write about Programming, Algorithms and just about anything under the sun]]></description>
    <lastBuildDate>Tue, 26 Apr 2016 20:44:55 GMT</lastBuildDate>

    <item>
            <title>Hello World!</title>
            <link>http://shreyans-sheth.me/blog/home.html</link>
            <pubDate>Fri, 26 April 2016 14:34:13 +0000</pubDate>
            <description><![CDATA[GSoC '16 #awwwyea']]></description>
            <content:encoded><![CDATA[
                <p>And finally it's all paid off. Endless IRC conversations, reading code and tutorials I would barely understand at first and all those sleepless nights coding, waiting for mentor replies and the results.</p>
                <p>Selected for Google Summer of Code '16 with OpenMRS</p>
                ]]>
            </content:encoded>
        </item>
  </channel>
</rss>

当我尝试在此处验证XML Feed时:http://www.feedvalidator.org/check.cgi?url=http%3A%2F%2Fshreyans-sheth.me%2Fblog%2Ftuesdays-gone.xml

你可以检查我得到的错误。我被特别要求在字段和idk中包含内容标记,但内容Feed中的数据未经过验证并显示在Feed中。日期似乎也存在问题。可能是什么问题?

1 个答案:

答案 0 :(得分:1)

您需要declare namespace content

<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
<channel>
...
</channel>
</rss>

此日期<pubDate>Fri, 26 April 2016 14:34:13 +0000</pubDate>的格式应为<pubDate>Tue, 26 Apr 2016 14:34:13 +0000</pubDate>。 ('April'=&gt;'Apr'和'Fri'=&gt;'星期二'才有效)

完成这些更改后,您的示例Feed才有效。验证器还建议添加guid元素并添加atom:link

的命名空间
相关问题