Proper XML format output

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
sanjeev_sithara
Participant
Posts: 15
Joined: Wed May 26, 2004 6:30 am

Proper XML format output

Post by sanjeev_sithara »

Hi I want to generate one xml file usinf datastasge 7.5 server job
the file should look like


- <position>
- <bondfwd>
<Position_Name>ACGB Fwd</Position_Name>
<Notional>660000</Notional>
- <customBucketList>
- <customBucket>
<customDimensionName>Account_ID</customDimensionName>
<customBucketValue>9369</customBucketValue>
</customBucket>
- <customBucket>
<customDimensionName>Account_Name</customDimensionName>
<customBucketValue>Real Asset</customBucketValue>
</customBucket>
</customBucketList>
</bondfwd>
- <bondfwd>


But while generation thru datastasge it is generating as


- <position>
- <bondfwd>
<Position_Name>ACGB Fwd </Position_Name>
<Notional>660000</Notional>
- <customBucketList>
- <customBucket>
<customDimensionName>Account_ID Account_Name</customDimensionName>
<customBucketValue>9369 Real Asset</customBucketValue>
</customBucket>
</customBucketList>
</bondfwd>
- <bondfwd>


I have defined the grammar as

Position_Name-------/position/bondfwd/Position_Name/text()
Notional------------/position/bondfwd/Notional/text()
Account_ID----------/position/bondfwd/customBucketList/customBucket/customDimensionName
Account_ID_value----/position/bondfwd/customBucketList/customBucket/customBucketValue/text()
Account_Name--------/position/bondfwd/customBucketList/customBucket/customDimensionName
Account_Name_value--/position/bondfwd/customBucketList/customBucket/customBucketValue/text()

My source data looks like

Position_Name,Notional,Account_ID,Account_ID_value,Account_Name,Account_Name_value
ACGB Fwd,660000,Account_ID,9369,Account_Name,Real Asset

Please help me to get the proper output format.
Thanks for you help.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

One trick you can try with XML output is to create a sample XML output file in notepad, similar to the one you created in your example, then import it using import XML table. The importer will convert it to a set of column definitions which you can load into your XML output stage or use to set up your existing columns.
Post Reply