on 01-05-2016 8:40 PM
Hi gurus, I have to convert a flat file in not a secuencial order into a deep nest xml file
the input file after FCC is as follow
<Recordset>
<Header>
<Value1>H1</Value1>
<Value2>H2</Value2>
</Header>
<HeaderPed>
<Value1>1</Value1>
<Value2>2</Value2>
</HeaderPed>
<DetailsPed>
<Value1>D1</Value1>
<Value2>D2</Value2>
</DetailsPed>
<HeaderPed>
<Value1>3</Value1>
<Value2>4</Value2>
</HeaderPed>
<DetailsPed>
<Value1>D3</Value1>
<Value2>D4</Value2>
</DetailsPed>
<DetailsPed>
<Value1>D5</Value1>
<Value2>D6</Value2>
</DetailsPed>
<DetailsPed>
<Value1>D7</Value1>
<Value2>D8</Value2>
</DetailsPed>
<Footer>
<Value1>1</Value1>
<Value2>2</Value2>
</Footer>
</Recordset>
The output file most be generate as follow:
<Recordset>
<Header>
<Value1>H1</Value1>
<Value2>H2</Value2>
</Header>
<HeaderPed>
<Value1>1</Value1>
<Value2>2</Value2>
<DetailsPed>
<Value1>D1</Value1>
<Value2>D2</Value2>
</DetailsPed>
</HeaderPed>
<HeaderPed>
<Value1>3</Value1>
<Value2>4</Value2>
<DetailsPed>
<Value1>D3</Value1>
<Value2>D4</Value2>
</DetailsPed>
<DetailsPed>
<Value1>D5</Value1>
<Value2>D6</Value2>
</DetailsPed>
<DetailsPed>
<Value1>D7</Value1>
<Value2>D8</Value2>
</DetailsPed>
</HeaderPed>
<Footer>
<Value1>1</Value1>
<Value2>2</Value2>
</Footer>
</Recordset>
That's it, each <DetailsPed> Node in its corresponding <HeaderPed> Node.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hector
If there is a field in HeaderPed with a matching value to a field in DetailsPed, then you can use XSLT to deepened the XML. More details in my article below.
Alternatively, you can opt for a custom adapter module that I have developed specifically to tackle FCC for deep structures. Check it out below:-
Rgds
Eng Swee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Hector,
I believe the XML is sample. But in your actual data do you know if each HeaderPed has any indication of how many DetailPed each of them has?
Like in your example 1st HeaderPed should say there is 1 DetailPed, 2nd HeaderPed should say there is 3 DetailPed. Not sure if you have it, then it makes the mapping more easier.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.