Page 1 of 1

How to create XML Document with Multiple Repeated Elements

Posted: Wed May 15, 2013 9:58 am
by Qualta
I have a requirement in which i have to generate a xml document with multiple repeated elements using xml output stage. I can able to successfully generate the Xml file with one repeated element, I can't able to create with multiple repeated elemnts. Please help me in achieveng this....here is the scenario

Below is the format which I required

Code: Select all

	<InternalReleaseList>
		<InternalRelease>
			<TitleName>Higher Ground</TitleName>
			<TitleID>38323</TitleID>
			<InternalReleaseID>33410</InternalReleaseID>
			<RentrakID>64855</RentrakID>
			<ReleaseIndicatorList>
				<ReleaseIndicator>AMCSelect</ReleaseIndicator>
				<ReleaseIndicator>SensoryFriendlyFilm</ReleaseIndicator>
			</ReleaseIndicatorList>
			<MediaFormatName>35mm</MediaFormatName>
			<MPAARatingCode>R</MPAARatingCode>
			<PerformanceScheduleList>
				<PerformanceSchedule>
					<TheatreNumber>2798</TheatreNumber>
					<AuditoriumID>4</AuditoriumID>
					<ShowDateTime>2011-11-20T16:00:00</ShowDateTime>
					<RadiantPerformanceID>82399</RadiantPerformanceID>
				</PerformanceSchedule>
				<PerformanceSchedule>
					<TheatreNumber>2798</TheatreNumber>
					<AuditoriumID>4</AuditoriumID>
					<ShowDateTime>2011-11-22T13:30:00</ShowDateTime>
					<RadiantPerformanceID>82442</RadiantPerformanceID>
				</PerformanceSchedule>
				<PerformanceSchedule>
					<TheatreNumber>2798</TheatreNumber>
					<AuditoriumID>4</AuditoriumID>
					<ShowDateTime>2011-11-20T13:30:00</ShowDateTime>
					<RadiantPerformanceID>82398</RadiantPerformanceID>
				</PerformanceSchedule>
				<PerformanceSchedule>
					<TheatreNumber>2798</TheatreNumber>
					<AuditoriumID>4</AuditoriumID>
					<ShowDateTime>2011-11-18T10:45:00</ShowDateTime>
					<RadiantPerformanceID>82353</RadiantPerformanceID>
				</PerformanceSchedule>
			</PerformanceScheduleList>
		</InternalRelease>
	</InternalReleaseList>

Here InternalRelease, ReleaseIndicator and PerformanceSchedule are repetable elments..I can able to successfully handle InternalRelease and ReleaseIndicator repeatability, but I am not able to handling the PerformanceSchedule..

Below is the format which I am getting..

Code: Select all

			<InternalRelease>
			<TitleName>Higher Ground</TitleName>
			<TitleID>38323</TitleID>
			<InternalReleaseID>33410</InternalReleaseID>
			<RentrakID>64855</RentrakID>
			<ReleaseIndicatorList>
				<ReleaseIndicator>AMCSelect</ReleaseIndicator>
				<ReleaseIndicator>SensoryFriendlyFilm</ReleaseIndicator>
			</ReleaseIndicatorList>
			<MediaFormatName>35mm</MediaFormatName>
			<MPAARatingCode>R</MPAARatingCode>
			<PerformanceScheduleList>
				<PerformanceSchedule>
					<TheatreNumber>2798</TheatreNumber>
					<AuditoriumID>4</AuditoriumID>
					<ShowDateTime>2011-11-20T16:00:00</ShowDateTime>
					<RadiantPerformanceID>82399</RadiantPerformanceID>
				</PerformanceSchedule>
			</PerformanceScheduleList>
		</InternalRelease>
		<InternalRelease>
			<TitleName>Higher Ground</TitleName>
			<TitleID>38323</TitleID>
			<InternalReleaseID>33410</InternalReleaseID>
			<RentrakID>64855</RentrakID>
			<ReleaseIndicatorList>
				<ReleaseIndicator>AMCSelect</ReleaseIndicator>
				<ReleaseIndicator>SensoryFriendlyFilm</ReleaseIndicator>
			</ReleaseIndicatorList>
			<MediaFormatName>35mm</MediaFormatName>
			<MPAARatingCode>R</MPAARatingCode>
			<PerformanceScheduleList>
				<PerformanceSchedule>
					<TheatreNumber>2798</TheatreNumber>
					<AuditoriumID>4</AuditoriumID>
					<ShowDateTime>2011-11-22T16:00:00</ShowDateTime>
					<RadiantPerformanceID>82443</RadiantPerformanceID>
				</PerformanceSchedule>
			</PerformanceScheduleList>
		</InternalRelease>
Instead of creating PerformanceSchedule repeatable heirarchy it is creating seperate record.

Can any one please help me with this..

Thanks in Advance

Posted: Wed May 15, 2013 10:23 pm
by vmcburney
Are you using the older XML Pack or the newer XML Assembly? From memory the old XML Pack, via the XML Output stage, cannot do this but the new XML Assembly has an XML compose stage that makes this possible.

Posted: Fri May 24, 2013 10:13 am
by pnpmarques
Hello,
I believe that with xml output stage it should be possible to get what you want. Make sure that the column selected as Key is correct.
The order of the input records is also important since records from the same key must be together.
And of course be careful if you are processing in parallel mode, if you don't have performance issues set your stage to sequential.
Regards,
Pedro.

Posted: Fri May 24, 2013 3:34 pm
by eostic
You can do this with the older xmlOutput Stage, but it takes multiple iternations within the job, where you create each repeating node and then put them all together.......search the forum here for threads pointing to Kim Duke's site where you will find an invaluable document on XML Best Practices.....it describes in detail how to handle many things, among them the technique needed to write multiple repeating nodes.

As Vincent notes, if you have 8.5+, this can be accomplished in one Stage using the xml Stage...

Ernie

Posted: Tue May 28, 2013 9:34 am
by Qualta
Hi All,

Thanks for the replies and I am sorry for late response. Yes I am using oldeer XML pack (Xml output stage), that's why I am not getting expecting results.

And I alredy tried multiple iternations within the job, even that one also does not gave me the results because one of the repeatable field "ReleaseIndicator" is generating through Pivot(Horizontal) stage(As I need to send 11 fields results to one field), so the xml is not able to grouping the same key result.

So work around as temporary fix I did removed the pivot stage and creating 11 different fields instead of sending 11 fields results to one field in xml and after generating the xml I am renaming all 11 fields names with "ReleaseIndicator" throgh Unix script, Now I am getting expecting results, but it just a temp fix..I still need to work this out through datastage.

Posted: Tue May 28, 2013 10:11 am
by eostic
The method used to create the xml won't matter.....go look at it again, and find and review the best practices document noted above. You will have one xml stage for each of your repeating groups (or at least for the first two)....then for the third, you combine the others with it after performing a lookup......the method can be time consuming, but it works.

Ernie

Posted: Thu May 30, 2013 5:25 pm
by kduke
Follow my tag.