Module Sequel::Plugins::XmlSerializer::DatasetMethods
In: lib/sequel/plugins/xml_serializer.rb

Methods

to_xml  

Public Instance methods

Return an XML string containing all model objects specified with this dataset. Takes all of the options available to Model#to_xml, as well as the :array_root_name option for specifying the name of the root node that contains the nodes for all of the instances.

[Source]

     # File lib/sequel/plugins/xml_serializer.rb, line 390
390:         def to_xml(opts=OPTS)
391:           raise(Sequel::Error, "Dataset#to_xml") unless row_proc
392:           x = model.xml_builder(opts)
393:           name_proc = model.xml_serialize_name_proc(opts)
394:           array = if opts[:array]
395:             opts = opts.dup
396:             opts.delete(:array)
397:           else
398:             all
399:           end
400:           x.send(name_proc[opts.fetch(:array_root_name, model.send(:pluralize, model.send(:underscore, model.name))).to_s]) do |x1|
401:             array.each do |obj|
402:               obj.to_xml(opts.merge(:builder=>x1))
403:             end
404:           end
405:           x.to_xml
406:         end

[Validate]