I am implementing an application that manipulate XML documents using Ruby on Rails. I want to have models that encapsulate all the logic and then convert them to corresponding XML document when save. Although I do not need database persistence for my models, I want my models to have validation mechanism like ActiveRecord's. Also, for converting between XML and Ruby objects, an XML mapping library is preferred to make things easier.
Although there are quite a few solutions which allow using ActiveRecord without table, it seems to me the XML mapping libraries (e.g. ROXML, XML Mapping) do not seem to play well with ActiveRecord'S fields. In other words, it does not look like that they can be used together due to the conflict it their syntax.
Therefore, I would like to know what are the preferred solution in this case. The solution which allow the use of an XML binding library with tableless models with validation functionality.
For example, one solution is to have two separate models. One is tableless ActiveRecord and the other is plain Ruby objects with xml binding (like what is described in this post). The ActiveRecord models are for validation. To convert them to XML, it will need to be copies to XML binding models first. Although this solution does work, it is not elegant.