# Reading XML-file + saving to sqlite3 database

**URL:** <https://www.ruby-forum.com/t/reading-xml-file-saving-to-sqlite3-database/162996>\
**Category:** Rails\
**Created:** [March 16, 2009, 1:46pm UTC](https://www.ruby-forum.com/t/reading-xml-file-saving-to-sqlite3-database/162996 "2009-03-16T13:46:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![washi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/c57346/32.png) [@washi](https://www.ruby-forum.com/u/washi)\
**Post date:** [March 16, 2009, 1:46pm UTC](https://www.ruby-forum.com/t/reading-xml-file-saving-to-sqlite3-database/162996/1 "2009-03-16T13:46:20Z")

</div>

Hi!

I’m new with Ruby On Rails, so I don’t really know how I can get this  
fixed.  
As a result of a program, I’ve got +/- 20 XML files, and I would like  
to import them to my sqlite3 database. Each XML-file having it’s own  
table.

Now I think I need to read the xml-files first and process them later.  
I’ve done some research and found REXML, but I can’t get it working  
correctly.  
With “@cust\_xml\_string = File.read(“CUST.xml”)”, and debug  
(@cust\_xml\_string) i’ve been able to show the content of the xml on  
the screen.

I’ve also been using ‘Hash.create\_from\_xml’, but then I get the  
following error: ‘undefined method `create\_from\_xml’ for Hash:Class’  
And I think REXML is faster, isn’t it?

Now I’m a little bit stuck and confused on how to work further.

Thx!
