require 'nokogiri' module GoogleDataSource module DataSource class XmlData < Base #include ActionView::Helpers::NumberHelper def response cols = columns.map { |col| col.id || col.type } builder = ::Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml| xml.send(xml_class.pluralize, :type => 'array') do data.each do |datarow| xml.send(xml_class) do datarow.zip(cols).each do |val, key| xml.send("#{key}", val.is_a?(Hash) ? val[:v] : val) end end end end end builder.to_xml end end end end