# File lib/dm-serializer/to_xml.rb, line 79
        def to_xml_document(opts = {})
          xml = DataMapper::Serialize::XMLSerializers::SERIALIZER
          doc = xml.new_document
          root = xml.root_node(doc, "errors", {'type' => 'hash'})

          errors.each do |key, value|
            property = xml.add_node(root, key.to_s, nil, {'type' => 'array'})
            property.attributes["type"] = 'array'
            value.each do |error|
              xml.add_node(property, "error", error)
            end
          end

          doc
        end