class Bio::PhyloXML::Other

Attributes

attributes[RW]
children[RW]
element_name[RW]
value[RW]

Public Class Methods

new() click to toggle source
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 1174
def initialize
  @children = []
  @attributes = Hash.new
end

Public Instance Methods

to_xml() click to toggle source

Converts elements to xml representation. Called by PhyloXML::Writer class.

# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 1180
def to_xml
  o = LibXML::XML::Node.new(@element_name)
  @attributes.each do |key, value|
    o[key] = value
  end
  o << value if value != nil
  children.each do |child_node|
    o << child_node.to_xml
  end
  return o
end