# File lib/edi4r/rexml.rb, line 35 def to_xml( xel_parent, instance=1 ) xel = REXML::Element.new( normalized_class_name ) xel.attributes["name"] = @name xel.attributes["instance"] = instance if instance > 1 xel_parent.elements << xel instance_counter = Hash.new(0) each do |obj| i = (instance_counter[obj.name] += 1) obj.to_xml( xel, i ) unless obj.empty? end xel end