module DataMapper::Serializer::XML::REXML
Public Class Methods
add_node(parent, name, value, attrs = {})
click to toggle source
# File lib/dm-serializer/xml/rexml.rb, line 15 def self.add_node(parent, name, value, attrs = {}) node = parent.add_element(name) attrs.each do |attr_name, attr_val| node.attributes[attr_name] = attr_val end node << ::REXML::Text.new(value.to_s) unless value.nil? node end
add_xml(parent, xml)
click to toggle source
# File lib/dm-serializer/xml/rexml.rb, line 26 def self.add_xml(parent, xml) parent.add(xml) end
new_document()
click to toggle source
# File lib/dm-serializer/xml/rexml.rb, line 7 def self.new_document ::REXML::Document.new end
output(doc)
click to toggle source
# File lib/dm-serializer/xml/rexml.rb, line 30 def self.output(doc) doc.to_s end
root_node(document, name, attrs = {})
click to toggle source
# File lib/dm-serializer/xml/rexml.rb, line 11 def self.root_node(document, name, attrs = {}) add_node(document.root || document, name, nil, attrs) end