Please could anyone tell me the reason for this. I have a create_file action in my controller.
file = File.new("xml/experiment.xml", "w")
# creating the builder file for the xml
xml = Builder::XmlMarkup.new :target => file
# xml tags
xml.instruct!
xml.EXPERIMENT_SET {
xml.alias("#{@experiment.alias}")
xml.center_name "#{@experiment.center_name}"
}
I get an output like this.
<?xml version="1.0" encoding="UTF-8"?><EXPERIMENT_SET><alias>ZAP430</alias><center_name></center_name></EXPERIMENT_SET>
Which is not a neat XML, all tags are displayed in a single line.
Use the parameter
:indentwhile creating your instance ofXmlMarkup.From the documentation of
[Builder::XmlMarkup][1]: