> Reading your original message again, you said that you used writeRaw(). It
> doesn't work because Tapestry expects to have a root element. Using a single
> MarkupWriter.writeRaw() call doesn't generate a root element. MarkupWriter
> doesn't parse what writeRaw() writes, so it just knows when the root element
> was created when you invoke element() the first time. In this case, you
> can't use MarkupWriter to output Rome's output.
>
> You could, however, generate the RSS feed using MarkupWriter only, one
> element() call per element, without using Rome.


Yes, I got it. Absence of the root element was actually the cause of the
problem.

I've already read about onActivate () and TextStreamResponse, but tried to
>> avoid it.
>>
>
> Why? Taking a quick look at the Rome package, I've found the SyndFeedOutput
> class. It has a method, outputString(), that writes the XML output to a
> String. Your code will look like this:
>
> Object onActivate() {
>        SeedFeed feed = ...;
>        // populate feed
>        SyndFeedOutput sfo = new SyndFeedOutput();
>        String output = sfo.outputString();
>        return new TextStreamResponse(output, "text/xml");
> }
>
> It can't get easier than this. :)


That's a solution I've ended up with :)


> Using template to form RSS output is unfortunately not an option in my
>> case.
>>
>
> Why not? Just curious. :)
>
>
The RSS feed is complicated quite a lot, it must support various feeds from
various sections of the site, so I'm trying to encapsulate the logic only in
page handler, rather than in both handler and template.

-- 
Ilya Obshadko

Reply via email to