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.
This topic has been locked.
3 replies Latest Post - 2013-01-22T00:59:32Z by firstname.lastname@example.org
Pinned topic How to add "line breaks" when constructing a XML message?
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2013-01-22T00:59:32Z at 2013-01-22T00:59:32Z by email@example.com
elvis_gn 060001PHQE139 Posts
SystemAdmin 110000D4XK4179 PostsACCEPTED ANSWER
Re: How to add "line breaks" when constructing a XML message?2013-01-21T22:30:10Z in response to SystemAdminHi
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?
But I want it to look like this :
<item3>hello how are you?</item3>
How this can be done. This may sound silly to many of you but I am a newbie. Please help. Its urgent.
firstname.lastname@example.org 120000CJSH508 PostsACCEPTED ANSWER
Re: How to add "line breaks" when constructing a XML message?2013-01-22T00:59:32Z in response to SystemAdminThe 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.