I don't know if this will help, but I use a simple createTag to just
enclose the full xml so it has a root element:

   def createTag(in: NodeSeq) = {
       <apbul_apii>{in}</apbul_api>

  }

and then showArticles would call into a feed wrapper, passing in the
result of yield,  like this for an Atom feed:

//Reacts to Get all reguest
   def showArticles():AtomResponse = {
     val eList = for(e <- Content.findAll) yield {
            e.toAtom
          }

         AtomResponse(feedWrapper(eList))

   }

Glenn


On Oct 23, 6:24 am, wibblecp <wibbl...@gmail.com> wrote:
> hi guys,
> I'm looking for a way to generate an rss feed with lift, I'm working
> on something like this (from lift-book):
>
> object OwnRssFeed extends XMLApiHelper {
>   def dispatch: LiftRules.DispatchPF = {
>     case Req("rss" ::   Nil, "", GetRequest) => () => showArticles()
>     case Req("rss" :: _ :: Nil, "",  _) => failure _
>   }
>
>     def failure() : LiftResponse = {
>       val ret: Box[NodeSeq] = Full(<op id="FAILURE"></op>)
>       NotFoundResponse()
>     }
>
>     def createTag(in: NodeSeq) = {
>       println("[CreateTag] " + in)
>       <rss version="2.0">
>           <channel>
>               <title>title</title>
>               <link>http://example.org</link>
>               <description>Example.org</description>
>               <language>en-us</language>
>
>               <generator>Lift WebFramework</generator>
>                   {in}
>           </channel>
>       </rss>
>     }
>
>     def showArticles(): LiftResponse = {
>       val a: Box[NodeSeq] = for(a <- Article.find(By
> (Article.published, true))) yield {
>          a.toXML
>       }
>       a
>     }
>
> }
>
> obviously the yield into the definition of showArticles method break
> the cycle to the first one.
>
> Could you suggest me what I can do? I am evaluating lift and scala
> just in a while.
> Thanks for your attention.
> w.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to