Import the data from the XML files into a MySQL database

I would like to build a Rails application to import the data from a XML file into a MySQL database. Any help?

Upvotes: 1

Views: 2099

Answers (1)

Arsen7
Arsen7

Reputation: 12830

Why do you need Rails for this task? Will the XML file be uploaded by users? If not, then a script in ruby may be all you need.

In all cases you need to:

  • parse incoming XML and set the properties of some object or variables
  • save these properties or variables in the database.

For the first task you may use ReXML, LibXML, Nokogiri or any other XML parser library.

For the second (if you don't use ActiveRecord in Rails), you may see the documentation for the mysql2 gem.

Feel free to ask further questions if you have any problems with these libraries.

Upvotes: 1

Related Questions