Is anyone using rxml files to generate XHTML to send to the browser? I''m thinking about doing this for a new project, it seems like a nice clean interface, and could potentially improve code sharing between AJAX and page generation. Also you''re guaranteed to generate good XML, you can''t accidentally omit tags or whatever. But if I understand it correctly, all the ActionView helper functions only work with .rhtml, is that right? I can''t, for example, use xml.link_to, so it seems like I would lose a lot of convenience functionality. Any advice or suggestions gratefully accepted.
> Is anyone using rxml files to generate XHTML to send to the browser? > I''m thinking about doing this for a new project, it seems like a nice > clean interface, and could potentially improve code sharing between > AJAX and page generation. Also you''re guaranteed to generate good XML, > you can''t accidentally omit tags or whatever. But if I understand it > correctly, all the ActionView helper functions only work with .rhtml, > is that right? I can''t, for example, use xml.link_to, so it seems like > I would lose a lot of convenience functionality. > > Any advice or suggestions gratefully accepted.To use the helpers, you do: xml << link_to(...) Or more likely: xml.p("Go places: #{link_to(..)}") -- David Heinemeier Hansson http://www.loudthinking.com -- Broadcasting Brain http://www.basecamphq.com -- Online project management http://www.backpackit.com -- Personal information manager http://www.rubyonrails.com -- Web-application framework
Would you mind elaborating on the code sharing part?>> I''m thinking about doing this for a new project, it seems like a nice >> clean interface, and could potentially improve code sharing between >> AJAX and page generation.- Ben
> Would you mind elaborating on the code sharing part?Actually I may have spoken too soon there. I''m learning Rails as I go on my current project, and since the data model is relatively complex I''m starting there, so my knowledge of the presentation aspects of Rails is read-only. One of the problems we have in my (Java-based) project in my day job is keeping the dynamically-generated (via AJAX) parts of the page in sync with the same elements as generated on the server side. I thought that using the XML interface might encourage generating small parts of the main page using helpers, and blending them into a whole - these small parts could then be returned to the client using AJAX, thus making it easier to ensure that the two are in step and minimising the client side code needed. But it looks like Rails provides this pretty well for RHTML files too.