# File lib/dm-serializer/to_xml.rb, line 79
    def to_xml_document(opts = {})
      xml = DataMapper::Serialize::XMLSerializers::SERIALIZER
      doc = xml.new_document
      default_collection_element_name = lambda {DataMapper::Inflector.pluralize(DataMapper::Inflector.underscore(self.model.to_s)).tr("/", "-")}
      root = xml.root_node(doc, opts[:collection_element_name] || default_collection_element_name[], {'type' => 'array'})
      self.each do |item|
        item.to_xml_document(opts, doc)
      end
      doc
    end