cancel
Showing results for 
Search instead for 
Did you mean: 

File sender adapter: Content conversion for very deep nested structure

Former Member
0 Kudos

Hi all

I have a file which looks like this

HDD    9800000660980000061911062009AA123456bbWM100012349800000619 
DDD_TEST001 4012YAG1  
WZOA00000000010000000001
WZOA00000000020000000002
IAAXX000001
IAAXX000002
C0000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004
T2

and my structure is

Header - 1

Detail - 0....Unbounded

Bag - 0.....Unbounded (sub node of detail)

Track - 0.....Unbounded (sub node of detail)

Customer - 0.....Unbounded (sub node of detail)

Trailer - 1

and in the file sender adapter i mentioned the following content conversion setting

HEADER,1,DETAIL,*,Bag,*,Track,*,Customer,*,TRAILER,*

But when i go and see in the monitoring i received the following conversion where BAG, TRACK and CUSTOMER nodes are outside detail.

<?xml version="1.0" encoding="utf-8" ?>

<ns:MT_REQ xmlns:ns="http://royalmail.com/dd_c">

<HEADER>

</HEADER>

<DETAIL>

<ID>D</ID>

<count/>

</DETAIL>

<Bag>

<ID>W</ID>

<Zone>ZOA</Zone>

</Bag>

<Bag>

<ID>W</ID>

<Zone>ZOA</Zone>

</Bag>

<Track>

<ID>I</ID>

<Item>AAXX000001</Item>

</Track>

<Track>

<ID>I</ID>

<Item>AAXX000001</Item>

</Track>

<Customer>

<ID>C</ID>

<OrigCustomer>00000000000000000001</OrigCustomer>

<Field1>00000000000000000001</Field1>

</Customer>

<TRAILER>

<ID>T</ID>

<Count>2</Count>

</TRAILER>

</ns:MT_REQ>

whereas i wanted bag, track and customer to be inside detail along with details data:

<?xml version="1.0" encoding="utf-8" ?>

<ns:MT_REQ xmlns:ns="http://royalmail.com/dd_c">

<HEADER>

</HEADER>

<DETAIL>

<ID>D</ID>

<count/>

<Mixed />

<Bag>

<ID>W</ID>

<Zone>zzz</Zone>

</Bag>

<Bag>

<ID>W</ID>

<Zone>zzz</Zone>

</Bag>

<Track>

<ID>I</ID>

<Item>AAXX000001</Item>

</Track>

<Track>

<ID>I</ID>

<Item>AAXX000001</Item>

</Track>

<Customer>

<ID>C</ID>

<OrigCustomer>00000000000000000001</OrigCustomer>

<Field1>00000000000000000001</Field1>

</Customer>

</DETAIL>

<TRAILER>

<ID>T</ID>

<Count>2</Count>

</TRAILER>

</ns:MT_REQ>

i.e. i need all Bag ,Track and Customer inside detail tag.

could anyone help me in this..i've already searched SDN and got some link as useful but none of them were totally related.

Regards

Naina

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member186158
Active Participant
0 Kudos

Maybe my blog will help you.

/people/peng.shen2/blog/2010/03/11/pixi-file-content-conversion-for-a-complex-structure

stefan_grube
Active Contributor
0 Kudos

> whereas i wanted bag, track and customer to be inside detail along with details data:

This is not possible.

Former Member
0 Kudos

Hi Stefan

How can i handle this kind of file then...is there any way out ??

Shabarish_Nair
Active Contributor
0 Kudos

naina,

ideally such scenarios are handled via a custom java or XSLT mapping.

Here you will read the file and convert it to an XML without hierarchy, then a java/xslt mapping will be used to build the following logic.

Another option would be to use tools like conversion agent and then do the XML conversion

/people/shabarish.vijayakumar/blog/2007/03/21/conversion-agent--silence-of-the-repeatinggroup-part-1

/people/shabarish.vijayakumar/blog/2007/03/21/conversion-agent--silence-of-the-repeatinggroup-part-2

Former Member
0 Kudos

thnks Shabarish

I am trying to apply this logic....will let you knw the updates

Regrds

Naina

Former Member
0 Kudos

Hi

cannot use Conversion Agent in my project

Can i make a User defined function between <Bag> on left and <Bag> on right and add some flag in a field of right side <Bag> so that when IDOC generates in CRM, they can see the flag and relate to which Detail it belonged to.

Or

Is there any way out to change the structure of xml dynamically so that i can map it to IDOC on right side correctly

Please suggest something guys

Regards

Naina

Former Member
0 Kudos

Hi all

One more question ....how to use two message mappings in a singe interface mapping and why do we use them ??

Can i use it in my scenario so that i make a java mapping first in which i convert the source structure to desired target structure and then make a second message mapping in which i map the new made structure to the IDOC on the target side

Naina