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 » replacing ''' with actual symbol through esql

Post new topic  Reply to topic
 replacing ''' with actual symbol through esql « View previous topic :: View next topic » 
Author Message
yshakraj
PostPosted: Wed Aug 29, 2012 10:28 pm    Post subject: replacing ''' with actual symbol through esql Reply with quote

Voyager

Joined: 14 Sep 2011
Posts: 91

pls tell me a way to replace ''' in the incoming data with " ' " in the esql
Back to top
View user's profile Send private message
nathanw
PostPosted: Wed Aug 29, 2012 11:37 pm    Post subject: Reply with quote

Knight

Joined: 14 Jul 2004
Posts: 550

try reading here

http://www.mqseries.net/phpBB2/viewtopic.php?t=61975&highlight=apos
_________________
Who is General Failure and why is he reading my hard drive?

Artificial Intelligence stands no chance against Natural Stupidity.

Only the User Trace Speaks The Truth
Back to top
View user's profile Send private message MSN Messenger
yshakraj
PostPosted: Thu Aug 30, 2012 1:48 am    Post subject: Reply with quote

Voyager

Joined: 14 Sep 2011
Posts: 91

I have read the link which you have suggested , i cannot make out anything from that link Could you please help me fix this.

Currently i'm using this function,
SET AcceptInputData = REPLACE(AcceptInputData, ''','\');

which is actually the incorrect one. Please tell me a way to put actual " ' " in place of "\".
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Thu Aug 30, 2012 3:03 am    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

yshakraj wrote:
pls tell me a way to replace ''' in the incoming data with " ' " in the esql

If you have xml coming in it will be like "<root> ... </root>". There might be "escaped" xml embeded within that... with XML-Entities (e.g. &lt;, &gt; and &apos;).

If you parse this with an XML-Parser then there are no more < and > (but just fields/elements and a tree) and the "escaped" xml should be an xml-string now (so with "<", ">" and "'")... it is "unescaped" now.

Parse this xml(-string) again and you have a logical message tree (of the originally embedded (and escaped) xml)).

You should really read the link provided by nathanw carefully.

If you still want to use REPLACE then try this:
Code:
SET AcceptInputData = REPLACE(AcceptInputData, '&apos;', '''');
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Aug 30, 2012 4:42 am    Post subject: Reply with quote

Grand High Poobah

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

yshakraj wrote:
I have read the link which you have suggested , i cannot make out anything from that link Could you please help me fix this.


What couldn't you make out?

You should never need to do what you're trying to do. What you're trying to do is at variance with the W3C XML standard.

Even if you succeed in using REPLACE or other means to change this value as soon as you output the XML you've created WMB will re-escape the value to &apos; because WMB's XML parser conforms to the W3C standard. If you finagle output as you suggest, the resulting XML document will fail to be parsed by any W3C compliant parser.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
nathanw
PostPosted: Thu Aug 30, 2012 4:45 am    Post subject: Reply with quote

Knight

Joined: 14 Jul 2004
Posts: 550

Vitor wrote:
yshakraj wrote:
I have read the link which you have suggested , i cannot make out anything from that link Could you please help me fix this.


What couldn't you make out?

You should never need to do what you're trying to do. What you're trying to do is at variance with the W3C XML standard.

Even if you succeed in using REPLACE or other means to change this value as soon as you output the XML you've created WMB will re-escape the value to &apos; because WMB's XML parser conforms to the W3C standard. If you finagle output as you suggest, the resulting XML document will fail to be parsed by any W3C compliant parser.


which is what I was trying to point out

am curious why there is a sudden raft of these queries abut replacing apos with '
_________________
Who is General Failure and why is he reading my hard drive?

Artificial Intelligence stands no chance against Natural Stupidity.

Only the User Trace Speaks The Truth
Back to top
View user's profile Send private message MSN Messenger
Vitor
PostPosted: Thu Aug 30, 2012 4:51 am    Post subject: Reply with quote

Grand High Poobah

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

nathanw wrote:
which is what I was trying to point out




Well quite, and I'm unclear why the OP "couldn't make anything out". Which I suspect is a euphamism for "I couldn't see where it was telling me how to do the silly thing I'm trying to do" but I'm in a grumpy mood this morning.

nathanw wrote:
am curious why there is a sudden raft of these queries abut replacing apos with '


Presumably there's a sudden raft of development involving home brew non-compliant W3C "parsers" that just look for "<" and ">" and go from there.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
yshakraj
PostPosted: Thu Aug 30, 2012 10:06 pm    Post subject: Reply with quote

Voyager

Joined: 14 Sep 2011
Posts: 91

Thanks mqsiuser!!!
It worked for me.
Code:

SET AcceptInputData = REPLACE(AcceptInputData, '&apos;', '''');



Regards,
yshak
Back to top
View user's profile Send private message
WBIMaestro
PostPosted: Mon Sep 03, 2012 2:25 pm    Post subject: Reply with quote

Acolyte

Joined: 18 Feb 2005
Posts: 53

I am seeing a similar issue, though not sure if the same solution would work for me.

I am using the IA9Z - job execution node to echo a string to a file to trigger something else. basically an 'echo' statement, but the '>>' is getting replaced by ' &gt &gt' in the output stream.

IVe tried using CDATA Tags and the ESQL CDATA.Section commands:

Code:
SET OutputRoot.XMLNSC.message.command.(XML.CDataSection) = COMMAND ;


but no success yet. would the above REPLACE clause or some variant of the same be a solution in this case?
basically the question is quite generic - i need to preserve the '>' as is when getting output to outputroot.xml tree. I am looking to set:

Quote:

SET OutputRoot.XMLNSC.message.command = "echo 'some string' >> some file"
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Mon Sep 03, 2012 3:12 pm    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

< and > are used by XML (for the elements ). Any XML-Parser will replace them (if they occur some place else, e.g. an embedded string) with &gt; and &lt; I think you cannot use REPLACE.

So: Dont use XMLNSC. Create a BLOB and write that out (or use MRM).

Code:
SET OutputRoot.BLOB = CAST('echo ''some string'' >> some file' AS BLOB);
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Sep 04, 2012 1:26 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I am using the IA9Z - job execution node to echo a string to a file to trigger something else. basically an 'echo' statement, but the '>>' is getting replaced by ' &gt &gt' in the output stream.
IF the output file is an XML file, THEN
a) XMLNSC is the correct choice of parser and
b) the ou
b) you will be reading the file using an XML parser, and it will automatically convert the '&gt;&gt;' back to '>>'.
ELSE
the output file is not XML, and you should use the BLOB parser to write it.
Quote:
i need to preserve the '>' as is when getting output to outputroot.xml tree
You cannot ever put the literal character '>' into an XML document. It's just not allowed by the XML specification. But you can put '&gt;' into the XML document, and it will be interpreted as '>' by any XML parser.
Back to top
View user's profile Send private message
rekarm01
PostPosted: Thu Sep 06, 2012 1:15 am    Post subject: Re: replacing '&apos;' with actual symbol through esql Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

WBIMaestro wrote:
I've tried using CDATA Tags and the ESQL CDATA.Section commands:

Code:
SET OutputRoot.XMLNSC.message.command.(XML.CDataSection) = COMMAND;

The XMLNSC parser requires XMLNSC parser constants:

Code:
SET OutputRoot.XMLNSC.message.(XMLNSC.CDataField)command = COMMAND;

The XMLNSC parser escapes any markup characters after the message flow executes its ESQL, so the REPLACE function is not a suitable option here.

kimbert wrote:
You cannot ever put the literal character '>' into an XML document. It's just not allowed by the XML specification.

Please double-check that.
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Sep 06, 2012 5:25 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
Please double-check that.
You're absolutely right. My statement was too strongly worded. I should have said 'You cannot ever put the character '>' into the value of an XML tag, unless you wrap it in a CData section.'
The main point stands, though. The XMLNSC parser is behaving reasonably, and the OP needs to check that they are approaching the problem in the right way.
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 » replacing '&apos;' with actual symbol through esql
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.