Page 1 of 1

Regarding XML Output

Posted: Fri Dec 17, 2010 1:33 am
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

Posted: Fri Dec 17, 2010 2:54 am
by ray.wurlod
If it's one attribute per line like that, constrain the stream not to pass any line containing "><"

Re: Regarding XML Output

Posted: Fri Dec 17, 2010 3:31 am
by samyamkrishna
Try to build teh xml using a Transformer stage with if else conditions.

Posted: Fri Dec 17, 2010 7:35 am
by chulett
Why would you "need" to remove that? It's perfectly valid XML. :?