Module: DataMapper::Serializer::XML::LibXML

### Home Classes Methods

### In Files

- lib/dm-serializer/xml/libxml.rb

### Methods

- ::add_node
- ::add_xml
- ::new_document
- ::output
- ::root_node

### 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::XML::LibXML

### Public Class Methods

add_node(parent, name, value, attrs = {}) click to toggle source

    # File lib/dm-serializer/xml/libxml.rb, line 22
    def self.add_node(parent, name, value, attrs = {})
      value_str = value.to_s unless value.nil?
      node = ::LibXML::XML::Node.new(name, value_str)

      attrs.each do |attr_name, attr_val|
        node[attr_name] = attr_val
      end

      parent << node
      node
    end

add_xml(parent, xml) click to toggle source

    # File lib/dm-serializer/xml/libxml.rb, line 34
    def self.add_xml(parent, xml)
      parent << xml.root.copy(true)
    end

new_document() click to toggle source

    # File lib/dm-serializer/xml/libxml.rb, line 7
    def self.new_document
      ::LibXML::XML::Document.new
    end

output(doc) click to toggle source

    # File lib/dm-serializer/xml/libxml.rb, line 38
    def self.output(doc)
      doc.root.to_s
    end

root_node(doc, name, attrs = {}) click to toggle source

    # File lib/dm-serializer/xml/libxml.rb, line 11
    def self.root_node(doc, name, attrs = {})
      root = ::LibXML::XML::Node.new(name)

      attrs.each do |attr_name, attr_val|
        root[attr_name] = attr_val
      end

      doc.root.nil? ? doc.root = root : doc.root << root
      root
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.