...

View Full Version : RSS feed will not validate



needsomehelp
02-06-2010, 01:25 PM
For some reason I am unable to get RSS to work properly.

It seems to work sort of in FireFox but not in IE.

Using the w3c Validator site it shows errors...

I have put stars *** to indicate what line these errors are on.

what is wrong with my code?

can anyone help me out.



----
This feed does not validate.

line 21, column 37: XML parsing error: <unknown>:21:37: not well-formed (invalid token) [help]

<guid>http://site.co.uk/?ac=vi&a=28012010</guid>
______________^

In addition, interoperability with the widest range of feed readers could be improved by implementing the following recommendation.


line 3, column 0: Undocumented use of atom:link [help]

<atom:link href="http://http://site.co.uk/rss.php" rel="self" type="appli ...
----




<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
*line 3*<atom:link href="http://http://site.co.uk/rss.php" rel="self" type="application/rss+xml" />
<channel>
<ttl>1</ttl>
<title>Welcome to Recent updates</title>
<link>http://site.co.uk/?s=rssimg</link>
<description>RSS Feed</description>
<language>en-us</language>
<pubDate>Sat, 06 Feb 2010 13:14:48 GMT</pubDate>
<lastBuildDate>Sat, 06 Feb 2010 13:14:48 GMT</lastBuildDate>

<generator>OnTheFly</generator>
<image>
<title>Welcome to Recent updates</title>
<url>http://site.co.uk/images/image.png</url>
<link>http://site.co.uk/?s=rssimg</link>
<width>88</width>
<height>31</height>

</image>
<item>
<title>View items</title>
*line 21* <guid>http://site.co.uk/?ac=v&a=20</guid>
<pubDate></pubDate>
</item>

<item>

<title>View Minutes</title>
<guid>http://site.co.uk/?m=22</guid>
<pubDate></pubDate>
</item>

<item>
<title>Next meeting</title>
<guid>http://site.co.uk/?ac=v&a=20</guid>

<pubDate></pubDate>
</item>

</channel>
</rss>

_Aerospace_Eng_
02-06-2010, 04:02 PM
You don't use <atom:link in an rss feed. You just use the first <link> element to define the url to your feed. Any ampersands & need to be changed to their html entities e.g. &amp; and GUIDs need to be unique. You repeated a few of your GUIDs. Also you can't have an empty pubDate. If its going to be empty don't put it in your feed.

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<ttl>1</ttl>
<title>Welcome to Recent updates</title>
<link>http://site.co.uk/rss.php</link>
<description>RSS Feed</description>
<language>en-us</language>
<pubDate>Sat, 06 Feb 2010 13:14:48 GMT</pubDate>
<lastBuildDate>Sat, 06 Feb 2010 13:14:48 GMT</lastBuildDate>

<generator>OnTheFly</generator>
<image>
<title>Welcome to Recent updates</title>
<url>http://site.co.uk/images/image.png</url>
<link>http://site.co.uk/?s=rssimg</link>
<width>88</width>
<height>31</height>

</image>
<item>
<title>View items</title>
<guid>http://site.co.uk/?ac=v&amp;a=20</guid>
<pubDate>Sat, 06 Feb 2010 13:14:48 GMT</pubDate>
</item>

<item>

<title>View Minutes</title>
<guid>http://site.co.uk/?m=22</guid>
<pubDate>Sat, 06 Feb 2010 13:14:48 GMT</pubDate>
</item>

<item>
<title>Next meeting</title>
<guid>http://site.co.uk/?ac=v&amp;a=23</guid>

<pubDate>Sat, 06 Feb 2010 13:14:48 GMT</pubDate>
</item>

</channel>
</rss>

needsomehelp
02-06-2010, 05:54 PM
I have taken out the

<atom:link href="http://http://site.co.uk/rss.php" rel="self" type="application/rss+xml" />

and replaced the & with &amp;

but still getting an error with validator.
----
This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations.

line 16, column 35: Image link doesn't match channel link [help]

<link>http://site.co.uk/?s=rssimg</link>
^
line 41, column 0: Missing atom:link with rel="self" [help]

</channel>
----

_Aerospace_Eng_
02-06-2010, 11:41 PM
What validator are you using?

MattF
02-08-2010, 01:39 AM
You don't use <atom:link in an rss feed.

The W3C validator does actually suggest including the atom link in RSS feeds, I believe.

The syntax is incorrect in the atom:link line. You're prefixing http:// to the URI.



<atom:link href="http://http://site.co.uk/rss.php" rel="self" type="application/rss+xml" />



Edit: I'd also suggest using the Validome validator. It doesn't give those poxy, (and pointless), 'warnings' like the W3C validator does, and it covers more than just feeds to boot:

http://www.validome.org/



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum