Author |
Message
|
satya2481 |
Posted: Thu Jul 28, 2011 7:30 pm Post subject: Issue with RCD Node and CRLF |
|
|
Disciple
Joined: 26 Apr 2007 Posts: 170 Location: Bengaluru
|
Hi All,
I am facing an issue with respect to usage of RCD node and \r\n character in the incoming message. Below are the details.
Flow
MQInputNode --> ComputeNode --> RCD Node --> MQOutputNode
Incoming Message = XML
Output Message = MRM XML
Coding done in Compute Node
- Map fields from XML domain to MRM XML Domain
- There are some text fields in the incoming message. These fields having LF or CRLF in the values. These values are replaced with CRLF
Example messages
Sample 1
Input :
Code: |
<Message>
<NotepadText>This is a test Message \r\n Can be deleted
</NotepadText>
</Message> |
Output :
Code: |
<Message>
<NotepadText>This is a test Message \r\r\n Can be deleted
</NotepadText>
</Message> |
Sample 2
Input :
Code: |
<Message>
<NotepadText>This is a test Message \n Can be deleted
</NotepadText>
</Message> |
Output :
Code: |
<Message>
<NotepadText>This is a test Message \r\n Can be deleted
</NotepadText>
</Message> |
I am able to get Sample 2 results
In case of sample 1 after the RCD node \r\n converted to \n
I want to retain the value (\r or \n or \r\n or \n\r) as it is in the incoming message even after the RCD node. How to do this. Why \r\n converted to \n after RCD node.
Am I missing some configuration in the message set ?
Thank You
Satya |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Jul 28, 2011 7:37 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Did you verify whether the input CCSID was the same as the output CCSID and was it the broker's CCSID (1200)?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
satya2481 |
Posted: Thu Jul 28, 2011 7:47 pm Post subject: |
|
|
Disciple
Joined: 26 Apr 2007 Posts: 170 Location: Bengaluru
|
I am not doing anything with the CCSID of the incoming message and output message.
However my code of replacing LF with CRLF looks like below....
Code: |
DECLARE CRLF CHARACTER CAST(X'0D0A' AS CHAR CCSID 850);
DECLARE LF CHARACTER CAST(X'0A' AS CHAR CCSID 850);
SET OutputRoot.MRM.NotepadText = REPLACE(InputRoot.XML.Message.NotepadText, LF, CRLF); |
- Satya |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Jul 28, 2011 8:00 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
satya2481 wrote: |
I am not doing anything with the CCSID of the incoming message and output message.
However my code of replacing LF with CRLF looks like below....
Code: |
DECLARE CRLF CHARACTER CAST(X'0D0A' AS CHAR CCSID 850);
DECLARE LF CHARACTER CAST(X'0A' AS CHAR CCSID 850);
SET OutputRoot.MRM.NotepadText = REPLACE(InputRoot.XML.Message.NotepadText, LF, CRLF); |
- Satya |
That's not what I asked.
What are the values of
OutputRoot.Properties.CodedCharSetId
OutputRoot.MQMD.CodedCharSetId
OutputRoot.MQMD.Format
 _________________ MQ & Broker admin |
|
Back to top |
|
 |
satya2481 |
Posted: Thu Jul 28, 2011 8:08 pm Post subject: |
|
|
Disciple
Joined: 26 Apr 2007 Posts: 170 Location: Bengaluru
|
Code: |
What are the values of
OutputRoot.Properties.CodedCharSetId
OutputRoot.MQMD.CodedCharSetId
OutputRoot.MQMD.Format |
I am not touching any of these values. Whatever comes in the input message same thing will be passed to OutputRoot.
Code: |
OutputRoot.Properties = InputRoot.Properties
OutputRoot.MQMD = InputRoot.MQMD |
My Broker is running on Windows Platform...
- Satya |
|
Back to top |
|
 |
rekarm01 |
Posted: Fri Jul 29, 2011 4:30 am Post subject: Re: Issue with RCD Node and CRLF |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
The XML parser is deprecated. XMLNSC is a better choice.
satya2481 wrote: |
I want to retain the value (\r or \n or \r\n or \n\r) as it is in the incoming message even after the RCD node. How to do this. Why \r\n converted to \n after RCD node. |
The XML standard requires that the parser normalize end-of-lines to LF upon input. This likely happens before the RCD node, not after it.
One way to preserve CRs is to replace them with character references, before parsing. |
|
Back to top |
|
 |
satya2481 |
Posted: Tue Aug 02, 2011 10:02 pm Post subject: |
|
|
Disciple
Joined: 26 Apr 2007 Posts: 170 Location: Bengaluru
|
Thank you for your replies...
My issue still not resolved. I have created a sample flow to understand the issue. I have observed below points.
Simple test flow looks as below
MQInput Node --> Compute Node --> RCD Node --> MQOutput Node
Points observed
1. If we do one to one mapping in the Compute node or if we call SET OutputRoot = IntputRoot then \r\n retains after the RCD node
2. If I use any String manipulation functions (Like SUBSTRING, REPLACE etc) and then assign the resulting value to OutputRoot fields then \r\n changed to \n
3. I have used MRM --> XML in RCD Node as well as XMLNSC parser. In both cases the results are same
4. I have stored the value in Environment which is unchanged after RCD node
Now I am planning to save the field values in Environment and then take it back after RCD node.
Please share any information if anyone know how to retain \r\n unchanged even after RCD node
Thank You |
|
Back to top |
|
 |
kimbert |
Posted: Wed Aug 03, 2011 3:56 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
An XML parser *must* normalize line feed characters. If you don't understand why, then please follow the link that rekarm01 gave you and read what the XML specification says about this.
Quote: |
1. If we do one to one mapping in the Compute node or if we call SET OutputRoot = IntputRoot then \r\n retains after the RCD node |
Yes. That's because message broke is smart enough to realize that you have not changed the message, so it can reuse the input bitstream. This result does not change anything that rekarm01 has said.
Quote: |
Please share any information if anyone know how to retain \r\n unchanged even after RCD node |
rekarm01 has already given you the answer. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Aug 03, 2011 4:00 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
satya2481 wrote: |
Please share any information if anyone know how to retain \r\n unchanged even after RCD node |
Did you read the links provided earlier on the XML standard? WMB is doing exactly what the standard requires it to do, and if you want the material retained you need to handle that situation as laid out in the XML standard.
The reason it doesn't change if you just assign input to output is that WMB does on-demand parsing, so unless you cause it to parse the document it doesn't, hence doesn't normalise the line feeds. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|