Simple-config can now output XML

require 'simple-config'

s = "
desc: A photo of a momentary push-button switch
file: push-button.jpg
tags: arduino button pushbutton raspberrypi electronics
"
puts SimpleConfig.new(s).to_xml

Output:

<?xml version='1.0' encoding='UTF-8'?>
<simpleconfig>
  <desc>A photo of a momentary push-button switch</desc>
  <file>push-button.jpg</file>
  <tags>arduino button pushbutton raspberrypi electronics</tags>
</simpleconfig>

A config file header can also be used e.g.

require 'simple-config'

s = "
<?simple-config type='media/image'?>

desc: A photo of a momentary push-button switch
file: push-button.jpg
tags: arduino button pushbutton raspberrypi electronics
"

puts SimpleConfig.new(s).to_xml

Output:

<?xml version='1.0' encoding='UTF-8'?>
<simpleconfig type='media/image'>
  <desc>A photo of a momentary push-button switch</desc>
  <file>push-button.jpg</file>
  <tags>arduino button pushbutton raspberrypi electronics</tags>
</simpleconfig>

Resources