AnsweredAssumed Answered

Mapping Flatfile format to XML format

Question asked by vijay.bontapalli137242 on Mar 29, 2016
Latest reply on Apr 11, 2016 by RanjiniElamkulammana2391

I have a flat file data similar to

ItemNumber|Quantity|Price|MfgDate|ExpDate

123|100|10.25|01-12-2015|01-12-2018

456|25|11.99|01-01-2016|01-01-2019

789|10|18.99|01-02-2014|01-02-2020

 

Need to convert to XML format...something like this

<Row>

  <Field><Name>ItemNumber</Name><Value>123</Value></Field>

  <Field><Name>Quantity</Name><Value>100</Value></Field>

  <Field><Name>Price</Name><Value>10.25</Value></Field>

  <Field><Name>MfgDate</Name><Value>01-12-2015</Value></Field>

  <Field><Name>ExpDate</Name><Value>01-12-2018</Value></Field>

</Row>

<Row>

  <Field><Name>ItemNumber</Name><Value>456</Value></Field>

  <Field><Name>Quantity</Name><Value>25</Value></Field>

  <Field><Name>Price</Name><Value>11.99</Value></Field>

  <Field><Name>MfgDate</Name><Value>01-01-2016</Value></Field>

  <Field><Name>ExpDate</Name><Value>01-01-2019</Value></Field>

</Row>

<Row>

  <Field><Name>ItemNumber</Name><Value>789</Value></Field>

  <Field><Name>Quantity</Name><Value>10</Value></Field>

  <Field><Name>Price</Name><Value>18.99</Value></Field>

  <Field><Name>MfgDate</Name><Value>01-02-2014</Value></Field>

  <Field><Name>ExpDate</Name><Value>01-02-2020</Value></Field>

</Row>

 

1. Number of rows and columns in flat file are unknown at design time.

2. For every row in flat file, need <Row></Row> element.

 

Do I need to write Groovy script for this or it can be mapped in Map activity. Appreciate your help. Thanks in advance.

Outcomes