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
  • 1.  documentToXML String --- Need to remove white space

    Posted Wed June 20, 2012 03:18 PM

    I have looked in this forum and have not found a real solution.

    Currently, the documenToXMLString will produce the string below….

    <?xml version="1.0" encoding="UTF-8"?> 1 TCCS.SAP_CCR

    I want it to produce one long string as follows:

    <?xml version="1.0" encoding="UTF-8"?> 1TCCS.SAP_CCR

    However…
    if you have multi-levels in the XML…where the tags are indented…several levels…
    using string replace is not a good option…
    I have to replace the following with ><

    <
    <
    <
    <

    when we use the documentToXMLString…
    it basically adds a lot of white space and doubles the string size it generates.

    The find string above does not show up correctly…

    < with 1 space char
    < with 2 space char
    < with 3 space char
    etc.


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


  • 2.  RE: documentToXML String --- Need to remove white space

    Posted Wed June 20, 2012 03:54 PM

    There is no easy way to output as wrapped XML and what document to xmlstring does is right of the format.

    You have to create your own custom way of removing new lines/spaces etc…from the xmldata itself.

    HTH,
    RMg


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


  • 3.  RE: documentToXML String --- Need to remove white space

    Posted Wed June 20, 2012 04:05 PM


  • 4.  RE: documentToXML String --- Need to remove white space

    Posted Thu June 21, 2012 12:45 PM

    Hi ,
    If we want to get rid of new lines and spaces here is what I have tried and it worked.I guess there is no inbuilt machenism to remove extra lines and spaces .you just need to play with some services.
    Thanks,
    Amol.

    [ATTACH=CONFIG]856[/ATTACH]
    sol1.JPG


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


  • 5.  RE: documentToXML String --- Need to remove white space

    Posted Sun June 24, 2012 12:32 AM

    This is a bad idea. It will undoubtedly produce incorrect results in various circumstances.


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


  • 6.  RE: documentToXML String --- Need to remove white space

    Posted Mon June 25, 2012 08:57 AM


  • 7.  RE: documentToXML String --- Need to remove white space

    Posted Mon June 25, 2012 12:40 PM

    Try using pub.string:replace with regex set to ‘true’. Search string pattern is >[\n\t\s]*< and replace it with ><

    [ATTACH=CONFIG]857[/ATTACH]
    HTH
    Senthil


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


  • 8.  RE: documentToXML String --- Need to remove white space

    Posted Mon June 25, 2012 03:55 PM

    Since your concern was for the size of the XML string, and thus presumably about the memory consumed by the string, you will want to consider that any manipulation of the XML string will result in at least double the memory usage.

    In the past I’ve implemented a way to control the documentToXMLString formatting but alas I know longer have the information. That would be the way to go if you really want to change the format.

    But I would advise this–leave it as is. There is likely very little benefit to gain in removing the whitespace between end/begin element tags. Unless the XML you’re generating is huge (say 500MB+) then you’re probably better off just accepting the existing format.


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