开发者

XML Schema (XSD) to Rails ActiveRecord Mapping?

I'm looking for a way to convert an XML Schema definition file into an ActiveRecord modeled database. Does anyone know of a tool that happens to do this?

So far the best way I've found is to first load the XSD into an RDBMS like postgres or mysql and then have rails connect to do a rake db:schema:dump. This however, only leaves me with a database without rails Models.

What would be the 开发者_开发知识库best way to import/load this xsd based database into rails?


Did you try gem magic_model_generator to generate the model from the db?

See: http://magicmodels.rubyforge.org/magic_model_generator/

Also, how did you load the XSD into your RDBMS? There seems to be plenty of discussion here: How can I create database tables from XSD files? Convert XSD into SQL relational tables

Update: I used Xml Spy (30 free trail, on windows, ug) to build tables from the xsd in a mysql db, then ran magic_model_generator on it to create ActiveRecord classes. It appears to have worked as you would expect, generating validators on the fields based on the the db schema.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜