Module: DataMapper::Serializer::ValidationErrors::ToXml

### Home Classes Methods

### In Files

- lib/dm-serializer/to_xml.rb

### Methods

- #to_xml
- #to_xml_document

### Files

- LICENSE
- README.rdoc

### Class/Module Index

Quicksearch

- DataMapper
- DataMapper::Collection
- DataMapper::Serializer
- DataMapper::Serializer::Collection
- DataMapper::Serializer::Collection::ToYaml
- DataMapper::Serializer::ValidationErrors
- DataMapper::Serializer::ValidationErrors::ToCsv
- DataMapper::Serializer::ValidationErrors::ToJson
- DataMapper::Serializer::ValidationErrors::ToXml
- DataMapper::Serializer::ValidationErrors::ToYaml
- DataMapper::Serializer::XML
- DataMapper::Serializer::XML::LibXML
- DataMapper::Serializer::XML::Nokogiri
- DataMapper::Serializer::XML::REXML
- DataMapper::Validations
- DataMapper::Validations::ValidationErrors
- Object

No matching classes.

# DataMapper::Serializer::ValidationErrors::ToXml

### Public Instance Methods

to_xml(opts = {}) click to toggle source

    # File lib/dm-serializer/to_xml.rb, line 67
    def to_xml(opts = {})
      to_xml_document(opts).to_s
    end

to_xml_document(opts = {}) click to toggle source

    # File lib/dm-serializer/to_xml.rb, line 71
    def to_xml_document(opts = {})
      xml = DataMapper::Serializer::XML.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

[Validate]

Generated with the Darkfish Rdoc Generator 2.