# File lib/edi4r/edifact-rexml.rb, line 143
    def to_din16557_4( xdoc )
      xel  = REXML::Element.new( self.name )
      names.uniq.each do |nm|
        # Array of all items with this name
        a = self[nm]; max = a.size
        raise "DIN16557-4 does not support more than 9 repetitions" if max > 9
        raise "Lookup error (should never occur)" if max == 0
        if max == 1
          obj = a.first
          obj.to_din16557_4( xel ) unless obj.empty?
        else
          a.each_with_index do |obj, i| 
            obj.to_din16557_4( xel, i+1 ) unless obj.empty?
          end
        end
      end
      xdoc.elements << xel
    end