cancel
Showing results for 
Search instead for 
Did you mean: 

mapping structure: combined segments

former_member440449
Participant
0 Kudos

Hi guys,

I have this problem while building an interface:

Source side has this structure:

<SEGMENT1> (1..unbounded)

<field1>

<field2>

<etc>

     <SEGMENT2> (1..unbounded)

     <field1>

     <field2>

     <etc>

     </SEGMENT2>

</SEGMENT1>

<SEGMENT3>

<field1>

<field2>

<etc>

</SEGMENT3> (1..1)

Please notice that SEGMENT2 is inside SEGMENT1.

Target side has this structure:

<SEGMENT1> (1..unbounded)

<field1>

<field2>

<etc>

</SEGMENT1>

<SEGMENT2> (1..unbounded)

<field1>

<field2>

<etc>

</SEGMENT2>

<SEGMENT3>

<field1>

<field2>

<etc>

</SEGMENT3> (1..1)

As you can see, all SEGMENTS are in the same level (at the root one).

My mapping is simple as pass-throw BUT in the target side I am expecting to have SEGMENT1 and then SEGMENT2 for each case. Example on the target side expected:

<SEGMENT1>

<field1>

<field2>

<etc>

</SEGMENT1>

<SEGMENT2>

<field1>

<field2>

<etc>

</SEGMENT2>

<SEGMENT1>

<field1>

<field2>

<etc>

</SEGMENT1>

<SEGMENT2>

<field1>

<field2>

<etc>

</SEGMENT2>

<SEGMENT3>

<field1>

<field2>

<etc>

</SEGMENT3>


Thas was the ideal case, but what I got now is the wrong case like this:

<SEGMENT1>

<field1>

<field2>

<etc>

</SEGMENT1>
<SEGMENT1>

<field1>

<field2>

<etc>

</SEGMENT1>

<SEGMENT2>

<field1>

<field2>

<etc>

</SEGMENT2>

<SEGMENT2>

<field1>

<field2>

<etc>

</SEGMENT2>

<SEGMENT3>

<field1>

<field2>

<etc>

</SEGMENT3>

All SEGMENT1 are stacked to top and then come all the SEGMENT2, and

I am capable to modify the structures of the source side, so is there any way to map it as the expected one?

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member184789
Active Contributor
0 Kudos

Hi,

Change the context of segment 2 ( CHild node) to the upper segment(higher context). It should work.

anupam_ghosh2
Active Contributor
0 Kudos

Hi Claudio,

                 Please upload exact sample payload structure along with XML root element.

Please kindly mention the version of Pi you are working with. You can get any target XML with java mapping.

Regards

Anupam

nabendu_sen
Active Contributor
0 Kudos

Hi Claudio,

You can achieve this using Java Mapping. The XSD is defined like below:

ROOT(1--1)

SEG1 (0--Unbounded)

SEG2 (0--Unbounded)

SEG3 (0--Unbounded)

So every time after completion of all SEG1, SEG2 will start to appear in your Target XML. Otherwise define your XSD like below:

ROOT(0--Unbounded)

SEG1 (1--1)

SEG2 (1--1)

SEG3 (1--1)

In this case all 1,2,3 will come under one parent ROOT and you have to populate ROOT multiple times.