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 » Is MB can Identify these values( '<' and '>')

Post new topic  Reply to topic
 Is MB can Identify these values( '<' and '>') « View previous topic :: View next topic » 
Author Message
ein
PostPosted: Sat May 16, 2009 10:23 pm    Post subject: Is MB can Identify these values( '<' and '>') Reply with quote

Centurion

Joined: 14 Mar 2009
Posts: 108

Helllo

My input msg contains some values characters like < and >

Ineed to convert those values into < and > .
I have used REPLACE and TRANSLATE functions.

Can any one help me plz..
Back to top
View user's profile Send private message
Vitor
PostPosted: Sun May 17, 2009 8:04 am    Post subject: Re: Is MB can Identify these values( '&lt;' and '&gt Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

[quote="ein"]Ineed to convert those values into < and > .
ein wrote:
nly confuse any XML parsers you encounter.

[quote="ein"]I have used REPLACE and TRANSLATE functions.


What happened when you tried this? Post your code.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kimbert
PostPosted: Sun May 17, 2009 12:02 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Here is my guess at your real requirement:
You are receiving an XML fragment embedded within another XML document. The sender has *not* used a CDATA section, so the sending application has replaced < and > ( and probably & ) with other characters.
You now need to parse the XML, so you need to perform the reverse transformation to recover the original XML message.

If my guess is correct, then the best solution is to change the sending application to
a) put a CDATA section around the embedded XML document
b) embed the document without doing any escaping of XML markup characters.

If the sending application cannot be changed, then REPLACE / TRANSLATE is the best solution.
Back to top
View user's profile Send private message
Vitor
PostPosted: Sun May 17, 2009 11:41 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

kimbert wrote:
Here is my guess at your real requirement:
You are receiving an XML fragment embedded within another XML document. The sender has *not* used a CDATA section, so the sending application has replaced < and > ( and probably & ) with other characters.
You now need to parse the XML, so you need to perform the reverse transformation to recover the original XML message.


Ah....
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
DTechBuddy
PostPosted: Sun May 17, 2009 11:50 pm    Post subject: Reply with quote

Novice

Joined: 05 May 2009
Posts: 20

I had a similar issue, where i was required to replace '&lt;' with '<' and '&gt;' with '>'.
After much tracing, i concluded that it cannot be handled at ESQL level.
REPLACE & TRANSALATE functions didn't worked for me, as the contents of trace revealed that Broker didn't recognise '&lt;' and '&gt;'.

Thus i took care of it at script level.
Using the commands as :-
sed 's/&lt;/</g' <InputFile> > <OutputFile>
sed 's/&gt;/>/g' <OutputFile> > <InputFile>
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon May 18, 2009 12:21 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

DTechBuddy wrote:
After much tracing, i concluded that it cannot be handled at ESQL level.


Yes it can!

Obviously requires some sleight of hand, depending on how stupid the input message is, but the PoC I've just done managed it in a simplistic example. I suspect the broker "didn't recognise" these characters as they'd been transformed to something else within the message tree.

This does not invalidate the advice of kimbert, as it's always best to send XML that's well-formed. Especially if you plan to parse it. Nor does it say that a sed script isn't a valid solution to a particular situation. Or the best solution in a given situation.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon May 18, 2009 1:23 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

DTechBuddy said:
Quote:
I had a similar issue, where i was required to replace '&lt;' with '<' and '&gt;' with '>'.
After much tracing, i concluded that it cannot be handled at ESQL level.
REPLACE & TRANSALATE functions didn't worked for me, as the contents of trace revealed that Broker didn't recognise '&lt;' and '&gt;'.
There are two possibilities here:
- REPLACE has a defect
- You were not using REPLACE correctly
If you cannot prove that REPLACE has a defect then you should not be giving advice like this.

For most users, a JavaCompute node would be a better solution than a script.
Back to top
View user's profile Send private message
ein
PostPosted: Mon May 18, 2009 3:43 am    Post subject: Reply with quote

Centurion

Joined: 14 Mar 2009
Posts: 108

kimbert wrote:
Here is my guess at your real requirement:
You are receiving an XML fragment embedded within another XML document. The sender has *not* used a CDATA section, so the sending application has replaced < and > ( and probably & ) with other characters.
You now need to parse the XML, so you need to perform the reverse transformation to recover the original XML message.

If my guess is correct, then the best solution is to change the sending application to
a) put a CDATA section around the embedded XML document
b) embed the document without doing any escaping of XML markup characters.

If the sending application cannot be changed, then REPLACE / TRANSLATE is the best solution.



Thanks Kimbert..

it works with CDATA.

Thank you very much
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 » Is MB can Identify these values( '&lt;' and '&gt;')
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.