Adding RSS support to a WebObjects project
Any worthwhile modern content management system needs to support RSS. The only real question is which format to support - RSS 1.0, RSS 2.0, or Atom. Without going into the details, it is worth supporting both 1.0 and 2.0 (at least). All three can be considered to be non-congruent current standards. If you want to support a broad range of standards, perhaps included embedded content (podcasts), or implement a feed consumer (rather than just publish a feed), you might want to look at Rome; see also this O'Reilly article on Rome.
For a brief introduction to RSS formats, see this tutorial. As you can see, RSS feeds follow an XML format. The document itself is remarkably simple (for XML); the root element is "rss", which contains a "channel" element, which is a description of your feed. Then an "item" element for each article in your feed. You may want to implement multiple channels, or multiple feed pages even, corresponding to different parts of your site.
WebObjects applications support XML in a number of different ways. For trivial XML, it is common to create a method in your EOs (or sometimes in a component) that returns a String containing the XML for that page; this would normally be constructed with simple java strings. This approach I would typically use to in interapplication communication, and then only for simple XML structures.
For more complex XML, there is a choice of two (!) different approaches. The simplest is to create a component with the html content replaced entirely with xml - this is the approach that I followed for the example. Just use WOString elements wherever you wish to insert content from your EOs. Another, very similar approach, is to build your xml component using WebObjects XML dynamic elements - WOXMLNode, and link these to a previously constructed XML document within your application. This may be more complex than is required for most sample uses; WOXMLNode was constructed by Apple to support their JavaClient programming model for WebObjects applications, which has since been allowed to rot on the vine. However, if your XML structure requires a lot of tag attributes rather than element content, it produces cleaner looking "html" parts for your wocomponents.
This really couldn't be much simpler. I have created a direct action to give a full site feed. To reach it, I added a RSS image to my PageWrapper component, with a additional link binding of type="application/rss+xml" (good for RSS 2.0 feeds). The direct action just returns my "RSSPage" component. Inside the component it loads all articles with a single call into the database framework, and everything else is handled in the component with a single repetition through all the articles.
Sample code has been included in the PCPro sample download.