XML construction for repeating duplicate values

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
parag.s.27
Participant
Posts: 221
Joined: Fri Feb 17, 2006 3:38 am
Location: India
Contact:

XML construction for repeating duplicate values

Post by parag.s.27 »

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 :-

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>
But Actually I need the payload construct as: -

Code: Select all

<ProfileData>
	<ProfileID>ID1</ProfileID>
		<Address>Address1</Address>
		<Address>Address2</Address>
		<Phone>Phone1</Phone>
		<Phone>Phone2</Phone>
</ProfileData>
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.
Thanks & Regards
Parag Saundattikar
Certified for Infosphere DataStage v8.0
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Why do you claim using separate elements for the different repeating groups is inefficient? It's a good way to get the job done, and pretty much self-documenting.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply