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 » Generating XML encoded message

Post new topic  Reply to topic
 Generating XML encoded message « View previous topic :: View next topic » 
Author Message
alechko
PostPosted: Tue Jul 08, 2008 12:14 am    Post subject: Generating XML encoded message Reply with quote

Apprentice

Joined: 12 Jan 2005
Posts: 37

Hi,

I'm trying to develop a flow that generates an xml message,
wraps it with a header xml but transforms the original xml message to encoded form with entity references.
I'll explain:

Let's say I have the following xml message:
Code:
<message>123</message>


I want to generate the following message:
Code:
<GeneratedMessage>&lt;message&gt;123&lt;/message&gt;</GeneratedMessage>


Is there are an elegant way to do this?
I thought about using some java code ...

I'd appreciate any kind of help!
Alik
Back to top
View user's profile Send private message Send e-mail
smdavies99
PostPosted: Tue Jul 08, 2008 1:29 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

It could be that using CDATA is the way to go here.

Could you explain why you want the original message encoded in that way?
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
sridhsri
PostPosted: Tue Jul 08, 2008 5:27 am    Post subject: Reply with quote

Master

Joined: 19 Jun 2008
Posts: 297

How about using ABITSTEAM and converting that XML message into a bitstream and then setting your envelope xml element's value to that bitstream ?
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Jul 08, 2008 5:44 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

sridhsri : That will not escape the XML markup characters, and it is not a good solution anyway. You should only use XML.AsisElementContent or XML.Bitstream when there is no other solution.
Let's wait until alechko states his requirement.
Back to top
View user's profile Send private message
alechko
PostPosted: Tue Jul 08, 2008 1:20 pm    Post subject: Reply with quote

Apprentice

Joined: 12 Jan 2005
Posts: 37

First of all, thank you all for your quick replies.

This requirement is due to the fact that the xml message might contain xml characters such as "<" and ">".
I agree that the best way to do so is using CDATA but ...
not all clients receiving and sending these message can generate or parse CDATA section.

Surprisingly enough, I found out the using ASBITSTREAM and afterwards "CREATE PARSE ..." as sridhsri suggested generated the whole string with "&lt;" and "&gt;".
Am I just plain lucky or is it the way it is supposed to work? Any other suggestions?

Thanks again,
Alik
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Wed Jul 09, 2008 12:43 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
Am I just plain lucky or is it the way it is supposed to work?
It is designed behaviour, and required by the XML spec. The parser will automatically escape any XML markup characters which appear within the value of an element ( unless the element type is CDataSection ). Otherwise it might generate badly-formed XML documents.

If your inner message is in the form of a message tree, then ASBITSTREAM is the correct way to convert it to a string. I presume the CREATE...PARSE was just your method of checking that you had achieved your goals - not part of the solution.
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 » Generating XML encoded message
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.