Sha256: 8395d24816ef576f5eaec77f8f564c9bcdc7372d48fb74e7411820c01ab12967

Contents?: true

Size: 732 Bytes

Versions: 26

Compression:

Stored size: 732 Bytes

Contents

module DataMapper
  module Serialize
    module XMLSerializers
      module REXML
        def self.new_document
          ::REXML::Document.new
        end

        def self.root_node(document, name, attrs = {})
          add_node(document.root || document, name, nil, attrs)
        end

        def self.add_node(parent, name, value, attrs = {})
          node = parent.add_element(name)
          attrs.each {|attr_name, attr_val| node.attributes[attr_name] = attr_val}
          node << ::REXML::Text.new(value.to_s) unless value.nil?
          node
        end

        def self.add_xml(parent, xml)
          parent.add(xml)
        end

        def self.output(doc)
          doc.to_s
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
dm-serializer-1.1.0.rc2 lib/dm-serializer/xml_serializers/rexml.rb
dm-serializer-1.1.0.rc1 lib/dm-serializer/xml_serializers/rexml.rb
ixtlan-0.4.3 lib/dm-serializer/xml_serializers/rexml.rb
ixtlan-0.4.2 lib/dm-serializer/xml_serializers/rexml.rb
ixtlan-0.4.1 lib/dm-serializer/xml_serializers/rexml.rb
dm-serializer-1.0.2 lib/dm-serializer/xml_serializers/rexml.rb
dm-serializer-1.0.1 lib/dm-serializer/xml_serializers/rexml.rb
ixtlan-0.4.0 lib/dm-serializer/xml_serializers/rexml.rb
ixtlan-0.4.0.pre5 lib/dm-serializer/xml_serializers/rexml.rb
ixtlan-0.4.0.pre4 lib/dm-serializer/xml_serializers/rexml.rb
ixtlan-0.4.0.pre3 lib/dm-serializer/xml_serializers/rexml.rb
dm-serializer-1.0.0 lib/dm-serializer/xml_serializers/rexml.rb
ixtlan-0.4.0.pre2 lib/dm-serializer/xml_serializers/rexml.rb
ixtlan-0.4.0.pre lib/dm-serializer/xml_serializers/rexml.rb
dm-serializer-1.0.0.rc3 lib/dm-serializer/xml_serializers/rexml.rb
ixtlan-0.3.0 lib/dm-serializer/xml_serializers/rexml.rb
dm-serializer-1.0.0.rc2 lib/dm-serializer/xml_serializers/rexml.rb
dm-serializer-1.0.0.rc1 lib/dm-serializer/xml_serializers/rexml.rb
ixtlan-0.2.4 lib/dm-serializer/xml_serializers/rexml.rb
ixtlan-0.2.3 lib/dm-serializer/xml_serializers/rexml.rb