IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Remove Empty Tag from an XML input

  • 1.  Remove Empty Tag from an XML input

    Posted Wed November 26, 2008 12:33 PM

    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


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 2.  RE: Remove Empty Tag from an XML input

    Posted Wed November 26, 2008 04:29 PM

    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.


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 3.  RE: Remove Empty Tag from an XML input

    Posted Wed November 26, 2008 08:00 PM

    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


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 4.  RE: Remove Empty Tag from an XML input

    Posted Tue December 02, 2008 07:00 AM

    Kapil,

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

    –Shaik


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods