Create hashes from XML documents easily.
MIT License
Create hashes from XML documents easily.
xml_converter
is heavily inspired by ActiveSupport::XMLConverter.
Add the dependency to your shard.yml
:
dependencies:
xml_converter:
github: mamantoha/xml_converter
Run shards install
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"}}
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)