Forum: Rails-core (closed, excessive spam) Best way to interface with XML databases

D77bd47db6f668a499a7eddb9c71a9c4?d=identicon&s=25 Francis Devereux (Guest)
on 2008-05-01 18:16
(Received via mailing list)
Hi,

I am trying to interface Rails with an XML database (Berkeley DB XML).

The sort of features that I want to implement are:
Essential:
  - load a complete XML document in the database into a tree of objects
  - save a tree of objects into an XML document in the database
  - introspect an XML schema (XSD) to determine the attributes that
model classes should have (similar in concept to the way ActiveRecord
determines the attributes of model classes by querying a relational
database's data dictionary)
  - marshalling HTTP POST from forms into (trees of) model objects

Desirable:
  - load part of an XML document into a tree of objects
  - lazy loading of associated XML nodes
  - partial updates of XML documents using XQuery Update

I'd appreciate any thoughts on the best general approach.  At the
moment I am considering two approaches:
1) Write an ActiveRecord connection adapter and either make the
adapter parse SQL and convert it to XQuery (which I'm not too keen on)
or monkey patch the parts of ActiveRecord that use SQL.
2) Write a new framework from scratch that borrows ideas from
ActiveRecord.

I've read previous discussions on non-SQL databases and ActiveRecord;
am I right in thinking that patches to refactor ActiveRecord to
separate out all of the SQL stuff would be unlikely to be accepted?

Any thoughts or advice would be very welcome!

Thanks,

Francis
821395fe70906c8290df7f18ac4ac6cf?d=identicon&s=25 Rick Olson (Guest)
on 2008-05-01 23:01
(Received via mailing list)
On 5/1/08, Francis Devereux <francis@devrx.org> wrote:
>  model classes should have (similar in concept to the way ActiveRecord
>  moment I am considering two approaches:
>  Any thoughts or advice would be very welcome!
The current thought is to refactor the model aspects from ActiveRecord
(validations, callbacks, etc) into ActiveModel, and use that for any
other ORM style libraries you want to write.  Then, you can just write
some ActiveBerkeley library using ActiveModel and mimicking
ActiveRecord's API where possible.

--
Rick Olson
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com
This topic is locked and can not be replied to.