I\'ve got a Rails controller which is going to output a hash in XML format - for example:
class MyController < ApplicationController
# GET /example.xml
de
I was having the same Issue;
This is my XML:
I was using this:
entries.to_xml
to convert hash data into XML, but this wraps entries' data into
So I modified:
entries.to_xml(root: "Contacts")
but that still wrapped the converted XML in 'Contacts'. modifying my XML code to
So it adds an extra ROOT that I don't wan't there.
Now solution to this what worked for me is:
entries["Contacts"].to_xml(root: "Contacts")
that avoids
or any additional root to be included.
Cheers!!