Skip to Content
0
Former Member
Oct 06, 2009 at 09:59 AM

Problem with missing input tag

47 Views

Hi,

When there is no inv2 in the first invoice tag of my input xml, the result breaks down. value of the 2. invoice tag moves up under the first item. Is it possible to correct this without addind an empty inv2 tag to the 1. invoice?

My mapping:

inv1-value -> itm1

inv2-value -> itm2

inv3-value -> itm3

input:

<root>
   <invoice>
      <inv1 value="1"/>
      <inv3 value="2"/>
   </invoice>
   <invoice>
      <inv1 value="3"/>
      <inv2 value="4"/>
      <inv3 value="5"/>
   </invoice>
</root>

output:

<root>
   <item>
      <itm1>1</itm1>
      <itm2>4</itm2>
      <itm3>2</itm3>
   </item>
   <item>
      <itm1>3</itm1>
      <itm3>5</itm3>
   </item>
</root>