XML construction for repeating duplicate values
Posted: Tue Oct 24, 2017 8:27 am
Hi,
I have a data condition where a customer has multiple addresses and phone numbers. I have a flat data set which looks like: -
ProfileID1 Address1 Phone1
ProfileID1 Address1 Phone2
ProfileID1 Address2 Phone1
ProfileID1 Address2 Phone2
When I am constructing the XML messages via XML composer, the result set is forming like :-
But Actually I need the payload construct as: -
This is just a representation data but there are many such attributes that are repeating due to Cartesian product in the flat data set.
Is there a way to do a de-duplication within XML composer?
Other ways to resolve this is done but they are not efficient. For e.g.: -
1. Construct separate XMLs for repeating elements and then join them and edit the XML
2. Create Java wrapper Jar that transforms the data in the required XML based on the XSD.
I have a data condition where a customer has multiple addresses and phone numbers. I have a flat data set which looks like: -
ProfileID1 Address1 Phone1
ProfileID1 Address1 Phone2
ProfileID1 Address2 Phone1
ProfileID1 Address2 Phone2
When I am constructing the XML messages via XML composer, the result set is forming like :-
Code: Select all
<ProfileData>
<ProfileID>ID1</ProfileID>
<Address>Address1</Address>
<Address>Address2</Address>
<Address>Address1</Address>
<Address>Address2</Address>
<Phone>Phone1</Phone>
<Phone>Phone2</Phone>
<Phone>Phone1</Phone>
<Phone>Phone2</Phone>
</ProfileData>
Code: Select all
<ProfileData>
<ProfileID>ID1</ProfileID>
<Address>Address1</Address>
<Address>Address2</Address>
<Phone>Phone1</Phone>
<Phone>Phone2</Phone>
</ProfileData>
Is there a way to do a de-duplication within XML composer?
Other ways to resolve this is done but they are not efficient. For e.g.: -
1. Construct separate XMLs for repeating elements and then join them and edit the XML
2. Create Java wrapper Jar that transforms the data in the required XML based on the XSD.