146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
# File 'lib/edi4r/edifact-rexml.rb', line 146
def to_din16557_4( xdoc )
xel = REXML::Element.new( self.name )
names.uniq.each do |nm|
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
|