views:

58

answers:

1

I have a Rails project and I used Migrations to setup the database schema (I'm using sqlite3). I have a XML file that I want to insert into my database. What's the best way to approach this? I'm thinking there's some Ruby script that I can write once and use to parse the XML file and insert it into my database, but intuitively it feels like this is a common problem and should have already been automated in the Ruby/Rails world. I guess some people would call this XML shredding, but querying Google hasn't turned up much for me.

Any thoughts?

+1  A: 

db/seeds.rb could be a good place to put the data.

Paul McMahon
are there built in scripts to easily map between XML nodes and data in the YAML format?
tom
you could try something like http://search.cpan.org/~ingy/YAML-0.35/bin/xyx.PL
Paul McMahon