# Best approach when data store is XML instead of a database?

**URL:** <https://www.ruby-forum.com/t/best-approach-when-data-store-is-xml-instead-of-a-database/177012>\
**Category:** Rails\
**Created:** [October 9, 2009, 7:56pm UTC](https://www.ruby-forum.com/t/best-approach-when-data-store-is-xml-instead-of-a-database/177012 "2009-10-09T19:56:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a587f6/32.png) [@kuma](https://www.ruby-forum.com/u/kuma)\
**Post date:** [October 9, 2009, 7:56pm UTC](https://www.ruby-forum.com/t/best-approach-when-data-store-is-xml-instead-of-a-database/177012/1 "2009-10-09T19:56:46Z")

</div>

Hi all,

Does anyone know of an approach/plugin that for model classes persisted  
to XML, as ActiveRecord works with databases? I’m aware of  
ActiveRecord::XMLSerialization, but I’d like to expand on that in two  
ways:

1. The ‘to\_xml’ method currently serializes descendant objects only when  
explicitly specified. I need to be able to say ‘to\_xml(:include =\>  
:all)’, so a complete document is written.

2. I’d like the XML schema to drive the definition of the model classes  
(like ActiveRecord). Doesn’t matter to me if that happens at run time  
or via a rake task.

We’re trying to avoid the ORM quagmire. We have complete control over  
both the XML schema and the model classes, so we can change the schema  
if necessary.

Thanks,

Brian

---

<div class="post-metadata">

**Author:** ![kuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a587f6/32.png) [@kuma](https://www.ruby-forum.com/u/kuma)\
**Post date:** [October 9, 2009, 8:08pm UTC](https://www.ruby-forum.com/t/best-approach-when-data-store-is-xml-instead-of-a-database/177012/2 "2009-10-09T20:08:52Z")

</div>

Brian H. wrote:

> Hi all,
> 
> Does anyone know of an approach/plugin that for model classes persisted  
> to XML, as ActiveRecord works with databases? I’m aware of  
> ActiveRecord::XMLSerialization, but I’d like to expand on that in two  
> ways:  
> […]  
> We’re trying to avoid the ORM quagmire.

Um, what “quagmire”? Have you worked with Rails ActiveRecord? It’s  
remarkably easy to use and versatile. And it looks like you’re jumping  
straight into the XML quagmire as a result – many people have tried to  
use XML files as databases, but I know of no decent way to do so with  
any scalability (eXistDB?).

I think you’re prematurely optimizing here. Use a real DB.

> We have complete control over  
> both the XML schema and the model classes, so we can change the schema  
> if necessary.

Well, that means you’d have complete control over a real DB too, right?

> Thanks,
> 
> Brian

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
