Skip to content

Parsing an XML file and inserting into a SQL database using the sequel gem and Nokogiri

Notifications You must be signed in to change notification settings

gary1410/xmlparse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

XMLParser

This is a XML Parser that will parse Aesop's Absence XML data and insert it into any SQL database according to the sequel gem (https://github.com/jeremyevans/sequel)

Version

1.0

Tech

Dillinger uses a number of open source projects to work properly:

  • [Ruby] - awesome web-based text editor
  • [Sequel Gem] - a super fast port of Markdown to JavaScript
  • [NokoGiri] - great UI boilerplate for modern web apps

Installation

run

$ bundle install

to include two dependencies: 1) gem 'nokogirl' and 2) gem 'sequel'

$ ruby parser.rb
.
.
$ sqlite3 absencedb [or whatever you want to name the database file here.  For example change 49 if necessary]
$ SELECT * FROM absencedata [whatever table name]

Note

You may change the passing variables in lines 49, 52, 55, and 58 to whatever names or file you'd like.

For example:

#creates the database file after each new instance
absence = Absence.new("choose DB Name")

#parses for AesopAbsences.xml or any file
parse = absence.parse('Choose XML file')

#creates table within the database
absence.create_table(:choose_table_name)

#inserts table with data in the database
absence.insert_table(:choose_table_name, parse)

About

Parsing an XML file and inserting into a SQL database using the sequel gem and Nokogiri

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages