= xml_data_builder
XmlDataBuilder renders Ruby data structures as XML using Builder.
It is designed to use the lowest common denominator between JSON and XML.
When using arrays as input XmlDataBuilder uses the key of the outer hash as a grouping tag and wraps the values in singularized tags.
Symbols and Strings are equivalent.
Usage is simple: You initialize XmlDataBuilder with ruby data structure and call #document:
puts XmlDataBuilder.new({}).document
puts XmlDataBuilder.new({:data => 1}).document
1
puts XmlDataBuilder.new({:outer => {:inner => 'data'}}).document
data
puts XmlDataBuilder.new({:outer => {:inner => 'data'}}, :indent => 0).document
data
puts XmlDataBuilder.new({:numbers => [1, 2, 3]}).document
1
2
3
puts XmlDataBuilder.new({:numbers => [{:value => 1, :type => 'odd'}, {:value => 2, :type => 'even'}]}).document
odd
1
even
2
puts XmlDataBuilder.new({:verbatim => XmlDataBuilder::CDATA.new('eßcape thïs!')}).document
== Caveat
The root element has to be a Hash and at least every second level has to be a Hash.
XML attributes are not supported.
== Installation
(sudo) gem install xml_data_builder
== Authors
Dr. Florian Odronitz (odo@mac.com)
== Contact
For questions, contact the authors or developer@traveliq.net
== Copyright
Copyright (c) 2011 www.travel-iq.com. See LICENSE.txt for
further details.