RSS Feed CDATA Troubleshooting - Code-Tips.com - Web Development, Programming, SEO

Wednesday, August 25, 2010

RSS Feed CDATA Troubleshooting

RSS2Writer v2.1 has been updated to v3.0 beta.  The new version can be downloaded at the Php FeedWriter website:  http://PhpFeedWriter.WebmasterHub.net/

Php FeedWriter (v3.0 beta) now provides the ability to output to various feed formats.  Php FeedWriter can currently generate Atom 1.0, RSS 2.0, RSS 1.0, RSS 0.92 and RSS 0.91 compatible feeds

View more information about Php FeedWriter, including online documentation.  For information about the latest update and release, see the article Php FeedWriter 3.0 (beta) Released.

A tutorial demonstrating how to build a feed using Php FeedWriter is also available on this blog:
How to Generate Feed Using Php (Atom 1.0 and RSS 2.0 Compatible)



RSS Feed CDATA was not working properly in the Php RSS 2.0 Writer class when trying to generate an RSS feed, as CDATA was not initially supported by the class. When the CDATA tags were included using '<![CDATA[' . $content . ']]>' as the value in the description element of the field, it didn't work.

Some of the things considered were the RSS feed reader being used to test the feed and if it supported the use of CDATA in an RSS feed, and if special characters were being encoded properly.  The intention was to allow content which would usually be parsed as and xml element to be ignored by the parser and included as characters (CDATA). This applies to a range of characters, but more commonly &,<,>, etc. used in html/xml markup.



Abdul Basit (abasit83) was able to fix the issue by including content in the xml element using the writeCData(...) method provided by the XMLWriter class.


View details about the Php RSS 2.0 Writer class that was being used, and more information about the CDATA mods.

The following resources provide some information about using CDATA in RSS feeds, and XML in general:
· C.28 When should I use a CDATA Marked Section?
· CDATA and formattedText in RSS XML
· RSS CData Item

0 comments:

Post a Comment