Remove Empty Tag from an XML input

Hello All,

I am having a requirement to remove empty tag from input XML string. e.g.

if my input is like :


John

then output would be like:


John


Did anyone face the same issue earlier. Anyhelp would be appreciated.

Regards
Kapil

I would say to do a XQL query like in your case:

/Employee/Telephone/text()

and see if any value return, if it does then map it to your documentType and convert it back to XML. You have to do this for each tag.

Another approach to this kind of problem is to use conditional mapping. Create a document reference as output and map the input to the output using conditional mapping. As in this situation, set “Evaluate copy condition” true, fill “Copy condition” with:
%Employee/Telephone%!=$null&%Employee/Telephone%!=’’

Thanks

guixia

Kapil,

Easy way to do it is just use replaceString(), find the required and replace it…

–Shaik