Formatting XML files

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
kumar66
Participant
Posts: 265
Joined: Thu Jul 26, 2007 12:14 am

Formatting XML files

Post by kumar66 »

Hi All,

I have my xml file format as :

<?xml version="1.0" encoding="UTF-8" ?>
- <!-- Generated by Ascential Software Corporation, DataStage - XMLOutput stage - Fri Jan 25 11:12:48 2008
-->
- <xtd:BO xmlns:xtd="http://service.gap.com/GenericSchema" xmlns:esb="http://service.gap.com/schemas/BHeader" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <esb:BHeader>
<esb:EnvironmentName>Development</esb:EnvironmentName>
<esb:VersionNbr>1.0</esb:VersionNbr>
- </esb:BHeader>
- <xtd:BOPayload>
- <xtd:Data>
- <![CDATA[ 30|8|84|842|02|2006241200|JAN 2007|2006241251|WK 51 -1/20/2007|+0000000047880.50|+0000000083334.80|+0000000013631|+0000000000000
]]>
</xtd:Data>
- <xtd:Data>
- <![CDATA[ 30|8|84|842|02|2006241200|JAN 2007|2006241251|WK 51 - 01/20/2007|+0000000047880.50|+0000000083334.80|+0000000013631|+0000000000000
]]>
</xtd:Data>
</xtd:BOPayload>
</xtd:BO>

Bascially I dont want to get the CDATA and Data Tag at the end of each record.

I want all my records in CDATA as one big chunk.

Please advise.

Thanks,
With Regards,
Kumar66


But I need the format to be
!-- Generated by Ascential Software Corporation, DataStage - XMLOutput stage - Mon Nov 19 15:49:21 2007
-->
- xtd:BO xmlns:xtd="http://service.gap.com/GenericSchema" xmlns:esb="http://service.gap.com/schemas/BHeader" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <esb:BHeader>
<esb:EnvironmentName>Development</esb:EnvironmentName>
<esb:VersionNbr>1.0</esb:VersionNbr>
- </esb:BHeader>
- <xtd:BOPayload>
- <xtd:Data>
- <xtd:BOPayload>
- <xtd:Data>
- <![CDATA[30|8|84|842|02|2006241200|JAN 2007|2006241251|WK 51 - 01/20/2007|+0000000047880.50|+0000000083334.80|+0000000013631|+0000000000000
30|8|84|842|02|2006241200|JAN 2007|2006241251|WK 51 - 01/20/2007|+0000000047880.50|+0000000083334.80|+0000000013631|+0000000000000
]]>
</xtd:Data>
</xtd:BOPayload>
</xtd:BO>
prasad111
Premium Member
Premium Member
Posts: 173
Joined: Fri May 19, 2006 10:53 am

Post by prasad111 »

Select the right repetative group (Select key as yes) in the XML Output stage. For more information refer to XML pdf document chapter 4, it describes how does repetition group works.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Repeating rows = repeating elements. That is by design.

What you might want to do, if all you want is to squish everything into a single giant CDATA specification, is to build the xml yourself. All you need is the tiny header information thru the CDATA opening, and the final closing tags. Put the header info in its own column in a Transformer, and append it (prefix) only to the very first row that comes into the Job. Concatenate the other columns in your row as needed, and keep flowing them into your selected target Stage without any formatting. When the job is done, apply the closing tag and be done. Then it will work with 10 rows or 10 million rows, and you wont have to worry about any sizing constraints in the XML stage.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Post Reply