AnsweredAssumed Answered

Comma separated flat file row to XML key value pair

Question asked by 94071669 on Sep 15, 2016
Latest reply on Sep 15, 2016 by Seth Duda

Hi,

 

I'm trying to read a csv file and convert into a XML Document with Header and Value capture as a repeating element for each row.

 

Source Document:

Header1,Header2,Header3

aa1,bb1,cc1

aa2,bb2,cc2,

aa3,bb3,cc3

 

I used Data Process to split flat file. Which results in individual documents of:

 

Header1,Header2,Header3

aa1,bb1,cc1

 

Header1,Header2,Header3

aa2,bb2,cc2

 

Header1,Header2,Header3

aa3,bb3,cc3

 

Now I need to capture each of these into an XML profile that has 0:Unbound elements (Header & Value)

Desired outcome:

Document 1:

 

<Root>

  <Header>Header1</Header> 

  <Value>aa1</Value>

</Root>

<Root>

  <Header>Header2</Header> 

  <Value>bb1</Value>

</Root>

<Root>

  <Header>Header3</Header> 

  <Value>cc1</Value>

</Root>

 

Document 2:

 

<Root>

  <Header>Header1</Header> 

  <Value>aa2</Value>

</Root>

<Root>

  <Header>Header2</Header> 

  <Value>bb2</Value>

</Root>

<Root>

  <Header>Header3</Header> 

  <Value>cc2</Value>

</Root>

 

Similarly Document 3

 

<Root>

  <Header>Header1</Header> 

  <Value>aa3</Value>

</Root>

<Root>

  <Header>Header2</Header> 

  <Value>bb3</Value>

</Root>

<Root>

  <Header>Header3</Header> 

  <Value>cc3</Value>

</Root>

 

Any Ideas?

 

Thanks

Outcomes