XML output with just a closing tag -- Urgent.

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
netboyks
Participant
Posts: 20
Joined: Sat Mar 08, 2003 7:43 am

XML output with just a closing tag -- Urgent.

Post by netboyks »

Below is the posting from cmuller.

Pipe any non repeating data to a hashed file stage, using serialno for the key. Then pipe repeating tags to the an xmloutput stage, and then to another hashed file stage to which you will write the repeating tags as xml chunks and use the serialno as key. It may look like this
SerialNo:1
TotalPayment: <Subtotal>124</Subtotal><Balance>1234</Balance> <Subtotal>156</Subtotal><Balance>1978</Balance> <Subtotal>678</Subtotal><Balance>9999</Balance> <Subtotal>563</Subtotal><Balance>4444</Balance>

Then you can join both hashed files using the second as a lookup and pipe it all to an xmloutput stage.

****
I am using the above logic (posted by cmuller) in my jobs and I am getting the output in the above format. Could some one tell how to change it to the below format.

TotalPayment: <Subtotal>124</Subtotal><Balance>1234</Balance> <Subtotal>156</Subtotal><Balance>1978</Balance> <Subtotal>678</Subtotal></Balance>


Please look at the last record. In summary I need to produce a closing tag (</Balance>) if there is no Balance value for the SubTotal.

Thanks

Netboyks.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

Call me crazy but this looks like invalid XML, how can you have a closing </BALANCE> tag when you don't have an opening <BALANCE> tag?
cmueller
Participant
Posts: 46
Joined: Wed Oct 23, 2002 7:10 am

Post by cmueller »

Do you mean an empty closing tag: <balance/>

If so, in the xmloutput stage, stage/transformation setting tab, set replace nulls with empty values and set empty element style to single tag(<tag/>)
Post Reply