Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
3 replies Latest Post - ‏2013-01-22T00:59:32Z by kimbert@uk.ibm.com
SystemAdmin
SystemAdmin
4179 Posts
ACCEPTED ANSWER

Pinned topic How to add "line breaks" when constructing a XML message?

‏2008-10-26T08:42:54Z |
Any one knows how to add "line breaks" when constructing a XML message using ESQL? What this ESQL statement to do that?

I intend to add line breaks between each XML element so that they can read easily after converting the whole XML created into a bit stream.
Updated on 2013-01-22T00:59:32Z at 2013-01-22T00:59:32Z by kimbert@uk.ibm.com
  • elvis_gn
    elvis_gn
    139 Posts
    ACCEPTED ANSWER

    Re: How to add "line breaks" when constructing a XML message?

    ‏2008-10-29T17:30:34Z  in response to SystemAdmin
    Hi,

    SET newLine = CAST(x'0A' AS CHARACTER CCSID InputRoot.Properties.CodedCharSetId);

    SET finalString = urString || newLine;

    Regards.
  • SystemAdmin
    SystemAdmin
    4179 Posts
    ACCEPTED ANSWER

    Re: How to add "line breaks" when constructing a XML message?

    ‏2013-01-21T22:30:10Z  in response to SystemAdmin
    Hi

    I am having the similar problem where we have to send some data in the email body and all the elements of XML should be in the new line. I am not able to construct it using the code as suggested in some other forums :
    DECLARE CRLF CHAR CAST(CAST('X''0D0A''' AS BLOB) AS CHAR CCSID InputRoot.Properties.CodedCharSetId );

    Right now the Email body looks like this :

    <item1><item2><item3>hello how are you?</item3></item2></item1>

    When I used the above Carriage Return code, it starts coming out like this :
    <item1><item2><item3>hello how are you?
    </item3></item2></item1>

    But I want it to look like this :

    <item1>
    <item2>
    <item3>hello how are you?</item3>
    </item2>
    </item3>

    How this can be done. This may sound silly to many of you but I am a newbie. Please help. Its urgent.

    Thanks
    Jazz
    • kimbert@uk.ibm.com
      kimbert@uk.ibm.com
      515 Posts
      ACCEPTED ANSWER

      Re: How to add "line breaks" when constructing a XML message?

      ‏2013-01-22T00:59:32Z  in response to SystemAdmin
      The line breaks are 'mixed content'.
      If you really need to do this then you will have to write some ESQL to add extra syntax elements to your message tree. The type of these extra syntax elements should be set to 'XMLNSC.PCDataValue'.

      Best way to see what I mean is
      • insert a Trace node in your flow
      • construct an example of the XML document that you want your flow to output
      • In the input node, set the XMLNSC parser options to 'Retain mixed content' ( this is not the default setting ).
      • Parse the example message
      • Look carefully at the structure of the message tree. Then make your flow produce something similar.

      ...but before you do any of that, you should consider whether you really do want to send XML in an email. Most users would prefer something more human-readable.