XML is most popular data transfer layer.
In every language we need XML parsing. In Ruby there is in build XML strong parsing support.
In this post I am going to cover the How to create XML file with simple Ruby code.
TIP: If you are new in Rails than follow step one or go to step two.
1. You need to install Ruby on your computer
2. Open command prompt(for windows) or console(linux)
3. Create file named CreateXML.rb and copy and paste following code
string = <<EOF
<element attribute=”attr”>first XML document with ruby </element>
doc = Document.new string
Output will be like this: