XMLConverter
Class to convert XML::Node or String object to Hash.
Simple example:
xml = <<-XML
<person id="1">
<firstname>Jane</firstname>
<lastname>Doe</lastname>
</person>
XML
document = XML.parse(xml)
hash = XMLConverter.new(document, content_key: :_value, collapse: false).to_h
=> {"person" => {"id" => "1", "firstname" => {:_value => "Jane"}, "lastname" => {:_value => "Doe"}}}
Options:
content_key - name for text property for elements with attributes and text
collapse - collapse elements that only contain text into a simple string property.
Constants
VERSION = {{ (`shards version /tmp/tmp.ECemhg/src/src`).chomp.stringify }}
Constructors
Instance methods
content_key
Sourceto_h
Source