Project

badgerhash

0.0
No commit activity in last 3 years
No release in over 3 years
Parse XML as IO into hash using badgerfish convention.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.5
~> 10.1.1
 Project Readme

Badgerhash

Build Status Code Climate

Convert XML to a Ruby Hash using the BadgerFish convention: http://badgerfish.ning.com/

The resulting Hash can be easily converted to JSON using a JSON library.

The reference implementation of the generators use REXML for parsing the given XML. REXML is included in the Ruby Standard Library so no depencies are introduced. Nevertheless, this library provides interfaces that allow using alternate parsers if performance is a concern.

Installation

Add this line to your application's Gemfile:

gem 'badgerhash'

And then execute:

$ bundle

Or install it yourself as:

$ gem install badgerhash

Usage

Generating a BadgerFish Hash Using a Stream Parser

require "badgerhash"
require "stringio"

xml = StringIO.new("<alice>bob</alice>")
xml_stream =  Badgerhash::XmlStream.create(xml)

puts xml_stream.to_badgerfish.inspect

Contributing

  1. Fork it ( http://github.com/gfmurphy/badgerhash/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request