Page 1 of 1

XML output with just a closing tag -- Urgent.

Posted: Tue Mar 02, 2004 12:59 pm
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.

Posted: Tue Mar 02, 2004 4:27 pm
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?

Posted: Tue Mar 02, 2004 7:47 pm
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/>)