AnsweredAssumed Answered

Converting Flat File to XML file

Question asked by bikram90 on Apr 30, 2017
Latest reply on May 1, 2017 by bikram90

Hi All,

 

Facing the below problem while converting a pipe delimited flat file to XML file.

 

Output XML file:

<?xml version='1.0' encoding='UTF-8'?>
<articule>
<version />
<id="2434">
<fetch id="23" mem="4" an="2017" />
<inventory>
<inventories id="ALC" contact="C/ALC/126/15-B">
<art id="01027303" cor="STAINED " lar="STAINED " fam="03" sfam="927" />
</inventories>
</inventory>
</articule>
<articule>
<version />
<id="2434">
<fetch id="23" mem="4" an="2017" />
<inventory>
<inventories id="ALC" contact="C/ALC/126/15-B">
<art id="00524049" cor="PUKKA " lar="PUKKA " fam="01" sfam="956" />
</inventories>
</inventory>
</articule>

 

 

Desired Output XML file:

<?xml version='1.0' encoding='UTF-8'?>
<articule>
<version>1.0</version>
<id="2434">
<fetch id="23" mem="4" an="2017" />
<inventory>
<inventories id="ALC" contact="C/ALC/126/15-B">
<art id="01027303" cor="STAINED " lar="STAINED " fam="03" sfam="927" />
</inventories>
</inventory>
<inventory>
<inventories id="ALC" contact="C/ALC/126/15-B">
<art id="00524049" cor="PUKKA " lar="PUKKA " fam="01" sfam="956" />
</inventories>
</inventory>
</articule>

 

The problem is the below elements are being repeated in the data process while combining.

<articule>
<version />
<id="2434">
<fetch id="23" mem="4" an="2017" />

</articule>

 

How to get the desired output

Outcomes