xml_converter v0.4.0

Create hashes from XML documents easily.
  • v0.4.0 - March 26, 2021
  • v0.3.0 - July 2, 2019
  • v0.2.0 - June 30, 2019

XMLConverter

CI

Create hashes from XML documents easily.

xml_converter is heavily inspired by ActiveSupport::XMLConverter.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      xml_converter:
        github: mamantoha/xml_converter
    
  2. Run shards install

Usage

require "xml_converter"

xml = <<-XML
  <person id="1">
    <firstName preferredName="Jane">Jehanne</firstname>
    <lastName>Doe</lastname>
  </person>
XML

document = XML.parse(xml)
hash = XMLConverter.new(document).to_h
# => {"person" => {"id" => "1", "firstName" => {"preferredName" => "Jane", :value => "Jehanne"}, "lastName" => "Doe"}}

Contributing

  1. Fork it (https://github.com/mamantoha/xml_converter/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 a new Pull Request

Contributors

Owner
github statistic
  • 3
  • 0
  • 0
  • 0
  • 24 days ago
  • November 25, 2018
License

MIT License

Links
Synced at

Mon, 19 Apr 2021 14:22:49 GMT