ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » handling special characters like ', & , etc during a MRM

Post new topic  Reply to topic
 handling special characters like ', & , etc during a MRM « View previous topic :: View next topic » 
Author Message
tas
PostPosted: Wed Aug 14, 2002 2:08 pm    Post subject: handling special characters like ', & , etc during a MRM Reply with quote

Newbie

Joined: 14 Aug 2002
Posts: 3

Hi guys,

I have run into a slight snag that I am hoping one of you has faced and would be able to help me out on.
I have a simple message flow as follows:

MqInput Node>>Compute1 Node >> RCD Node >> Compute2 Node >> MqOutput Node

The MqInput Node accepts the message as a BLOB.

The Compute1 Node calculates the length of the message and appends it to the BLOB message.

The RCD node uses a simple message set that has only two fields -- MsgLEN and the Message. The transform occurs normally.

Next the compute2 Node transforms the message to XML using: OutputRoot.Properties.MessageFormat = 'XML'

Finally the message is output on the queue in XML format.

So far so good....The trouble is in the text of the message itself. All the '&' and ''' signs get translated to ' and & . Is there any way of keeping the characters or of overlaying them with a blank space?

Thanks in advance
Back to top
View user's profile Send private message
dhaksr
PostPosted: Thu Aug 15, 2002 3:29 pm    Post subject: Reply with quote

Apprentice

Joined: 20 Feb 2002
Posts: 37

Same results for us also. Trace Node shows values properly but
it is incorrect in the Output queue.
Looks like a bug. Report this to your IBM rep and see how they respond.
Back to top
View user's profile Send private message
kirani
PostPosted: Thu Aug 15, 2002 3:37 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

This is not a bug! The XML Parser escapes these special character to ', etc. This is the correct way of representing these character into XML document. If you want to display & character instead, you could use AsisElementContent syntax element type in your ESQL code.

For example, following ESQL statement will produce output message as <name>AT&T</name>
SET OutputRoot.XML.name.(XML.AsisElementContent) = 'AT&T';
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
dhaksr
PostPosted: Thu Aug 15, 2002 3:55 pm    Post subject: Reply with quote

Apprentice

Joined: 20 Feb 2002
Posts: 37

Oops and Thx for saving the call to IBM rep
Back to top
View user's profile Send private message
tas
PostPosted: Wed Aug 21, 2002 11:51 am    Post subject: Reply with quote

Newbie

Joined: 14 Aug 2002
Posts: 3

Kirani thanks for the response. Just a couple of issues though.
i) The process seems to work fine if the message is being set to OutputRoot. However, the characters reappear if they are SET to the Environment.Variables section.

ii) once the message is SET using the AsisElementContent tag, I cannot manipulate the message anymore. i.e I can SET a new OutputRoot.XML.Message = InputRoot.XML.BLOBMSG; etc. The value for Message comes out as a blank.

Would appreciate your help on this
Back to top
View user's profile Send private message
kirani
PostPosted: Wed Aug 21, 2002 1:18 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

tas wrote:

i) The process seems to work fine if the message is being set to OutputRoot. However, the characters reappear if they are SET to the Environment.Variables section.

Data into Environment Tree is not parsed by XML parser. Environment Tree is just a global storage area. The structure of this tree is independent of any message domain/format.

tas wrote:

ii) once the message is SET using the AsisElementContent tag, I cannot manipulate the message anymore. i.e I can SET a new OutputRoot.XML.Message = InputRoot.XML.BLOBMSG; etc. The value for Message comes out as a blank.

I did not get this. Could you give an example here?


If your input XML message data has special character (&, <, >, etc.) in it, XML parser will throw an exception while parsing input message. When you create an output message you can assign special character values to it directly, for example,
SET OutputRoot.XML.name = 'AT&T';

While writing out this message to an output queue, XML writer will escape all special characters to corresponding literals. For example, & will be replaced by &amp; < will be replaced by &lt; and so on...

If you don't want XML writer to escape these characters, you can use AsisElementContent while assigning values to it.

I hope this explains the topic in more detail.
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
tas
PostPosted: Fri Aug 23, 2002 7:42 pm    Post subject: Reply with quote

Newbie

Joined: 14 Aug 2002
Posts: 3

OK, let me try to explain with the help of an example.

Current Process
1) I get the message as a blob from the Input Node. the message already contains special characters like & and '
2) I append the length of the mesage to the message.
3) I pass it thru a RCD using a message set message conating B_LEN and BLOBMSG.
4) I then issue a OutputRoot.Properties.MessageFormat = 'XML';
5) Once I have the message as an XML, the next node then starts saving certain parts of the BLOBMSG to the Environment variables section, using the SUBSTRING function.
6)The final step concatenates the Environment Variables to form a new OutputRoot.

This process works fine but translates the & to &amp; etc.

In trying to achieve keeping the specials characters in the original format, I tried the following approach.

1) Kept steps 1-3 as above.
2) In the next compute node, I copy only the Header's and SET OutputRoot.XML.XMLMESSAGE.(AsisElementContent) = "InputRoot"."MRM"."BLOBMSG"
3) At this point if I output the message to an Ouput Node, I get a XMLMESSAGE containing original message sent to the Input node with the special characters in the proper formating.
4) However, if I connect the previous compute node to another compute node and try the following:
SET OutputRoot.XML.XMLMESSAGE = SUBSTRING(InputRoot.XML.XMLMESSAGE FROM 1 FOR 10). and then send it the Output Node I just get empty <XMLMESSAGE> </XMLMESSAGE> tags.

I tried to get a handle on the original message by experimenting on the 4 th compute node. But was unsuccesfull. The end result is that I would like to parse the incoming message using substring and then reassemble it somewhere down the path yet maintain the character formating.

Thank you again for your assistance
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » handling special characters like ', & , etc during a MRM
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.