Regarding XML Output

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
Thripura
Participant
Posts: 26
Joined: Wed Jan 27, 2010 5:56 am

Regarding XML Output

Post by Thripura »

Hi,

In need to create an XML , the thing is if the value is not present for some tag i should not pass that tag.

Example:

At present the output is:

<Main>
<Customer>
<Name>ABC</Name>
<SurName></SurName>
<Age>23</Age>
</Customer>
</Main>

But i need output in this manner:

<Main>
<Customer>
<Name>ABC</Name>
<Age>23</Age>
</Customer>
</Main>

That means there is not "SurName" so i need to remove that..
Can anyone suggets how to do this.


Thanks,
Thripura
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If it's one attribute per line like that, constrain the stream not to pass any line containing "><"
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
samyamkrishna
Premium Member
Premium Member
Posts: 258
Joined: Tue Jul 04, 2006 10:35 pm
Location: Toronto

Re: Regarding XML Output

Post by samyamkrishna »

Try to build teh xml using a Transformer stage with if else conditions.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Why would you "need" to remove that? It's perfectly valid XML. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply