class Hermod::XmlSection

def to_xml

Returns an XML::Node

times are added in the order they were called.
the order they were defined in the DSL. Nodes that have been called multiple
sanitising them according to HMRC's rules) and then adds child nodes in
libxml-ruby). This creates this as a node, adds any attributes (after
Public: turns the XmlSection into an XML::Node instance (from
def to_xml
  XML::Node.new(self.class.xml_name).tap do |root_node|
    # Add attributes
    attributes.each do |attribute_name, attribute_value|
      sane_value = sanitise_attribute(attribute_value)
      root_node[attribute_name] = sane_value if sane_value.present?
    end
    # Add child nodes
    self.class.node_order.each do |node_name|
      nodes[node_name].each do |node|
        root_node << node.to_xml
      end
    end
  end
end