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 » Parsing '&' in Esql code

Post new topic  Reply to topic
 Parsing '&' in Esql code « View previous topic :: View next topic » 
Author Message
rock33
PostPosted: Sun Sep 22, 2013 11:18 am    Post subject: Parsing '&' in Esql code Reply with quote

Novice

Joined: 22 Mar 2013
Posts: 12

Hi

Is anyone knows how to parse '&' to the target xml. It is an hardcoded value at the compute node and the incoming parser is XMLNSC.

Ex:

Source attribute: <name id='&en' />

Expected target attribute: <name id='&en' />

Actual target attribute: <name id='&ampen' />

How to avoid append this 'amp' text to '&'.

Any advice would be appreciated.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Sep 22, 2013 11:34 am    Post subject: Re: Parsing '&' in Esql code Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

rock33 wrote:
Hi

Is anyone knows how to parse '&' to the target xml. It is an hardcoded value at the compute node and the incoming parser is XMLNSC.

Ex:

Source attribute: <name id='&en' />

Expected target attribute: <name id='&en' />

Actual target attribute: <name id='&ampen' />

How to avoid append this 'amp' text to '&'.

Any advice would be appreciated.


Don't worry. &en is illegal XML. The correct XML value is <name id='&amp;en' />
When extracted from the XML it will automatically revert to &en.

& is one of those values that HAVE to be escaped in XML.

Code:
SET ref.name.(XMLNSC.attr)id='&en';
-- will result in <name id='&amp;en' />


Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
rock33
PostPosted: Sun Sep 22, 2013 11:48 am    Post subject: Reply with quote

Novice

Joined: 22 Mar 2013
Posts: 12

Thanks for the reply fjb_saper.

My target is fileOutput node.

Below is the line in the compute node.
SET OutputRoot.XMLNSC.name.(XMLNSC.Attribute)ID = '&amp;en';

Outcome :

<name ID="&amp;amp;en;" />

Issue still exists.
Back to top
View user's profile Send private message
goffinf
PostPosted: Sun Sep 22, 2013 12:07 pm    Post subject: Reply with quote

Chevalier

Joined: 05 Nov 2005
Posts: 401

rock33 wrote:
Thanks for the reply fjb_saper.

My target is fileOutput node.

Below is the line in the compute node.
SET OutputRoot.XMLNSC.name.(XMLNSC.Attribute)ID = '&amp;en';

Outcome :

<name ID="&amp;amp;en;" />

Issue still exists.


Read fjb_saper's answer again (carefully).

In your code, Broker will convert the first & to the legal escape sequence &amp; and then add the string literal amp;en as indeed you have found.

Fraser.
Back to top
View user's profile Send private message
aggarwal.intouch
PostPosted: Mon Sep 23, 2013 1:43 am    Post subject: Reply with quote

Acolyte

Joined: 30 May 2011
Posts: 56
Location: India

When the XMLNS parser generates a bit stream from a message tree, occurrences of ampersand (&), less than (<), greater than (>), double quotation mark ("), and apostrophe ('), within the attribute value, are replaced by the predefined XML entities &amp;, &lt;, &gt;, &quot;, and &apos;.
Back to top
View user's profile Send private message Send e-mail
jsware
PostPosted: Mon Sep 23, 2013 2:57 am    Post subject: Reply with quote

Chevalier

Joined: 17 May 2001
Posts: 455

rock33 wrote:
Thanks for the reply fjb_saper.

My target is fileOutput node.

Below is the line in the compute node.
SET OutputRoot.XMLNSC.name.(XMLNSC.Attribute)ID = '&amp;en';

Outcome :

<name ID="&amp;amp;en;" />

Issue still exists.

Use the following line instead:
SET OutputRoot.XMLNSC.name.(XMLNSC.Attribute)ID = '&en';
_________________
Regards
John
The pain of low quaility far outlasts the joy of low price.
Back to top
View user's profile Send private message
rock33
PostPosted: Mon Sep 23, 2013 4:53 am    Post subject: Reply with quote

Novice

Joined: 22 Mar 2013
Posts: 12

[quote="jsware"]
rock33 wrote:


Use the following line instead:
SET OutputRoot.XMLNSC.name.(XMLNSC.Attribute)ID = '&en';



Have you tested jsware the above line of code?
Back to top
View user's profile Send private message
jsware
PostPosted: Mon Sep 23, 2013 5:06 am    Post subject: Reply with quote

Chevalier

Joined: 17 May 2001
Posts: 455

[quote="rock33"]
jsware wrote:
rock33 wrote:


Use the following line instead:
SET OutputRoot.XMLNSC.name.(XMLNSC.Attribute)ID = '&en';



Have you tested jsware the above line of code?
Not specifically - have you? What happens?
_________________
Regards
John
The pain of low quaility far outlasts the joy of low price.
Back to top
View user's profile Send private message
jsware
PostPosted: Mon Sep 23, 2013 5:53 am    Post subject: Reply with quote

Chevalier

Joined: 17 May 2001
Posts: 455

Looking again at what you want:

<name ID='&en'>

This is invalid XML as fjb_saber mentioned. So are you asking how you can produce an invalid XML document containing an unmarked-up ampersand?

What I suggested will produce:

<name ID='&amp;en'>

which is the XMLNSC parser working correctly.

If you are expecting '&en' to be an XML entity (like &amp;) then &en is slightly incorrect. All XML entities are in the form '&name;' - beginning with ampersand and ending with semicolon. &en is not a valid entity name format - just like &amp is incorrect too - its &amp;

To create inline DTD's that define custom XML entities, see http://pic.dhe.ibm.com/infocenter/wmbhelp/v9r0m0/topic/com.ibm.etools.mft.doc/ac67190_.htm for details.

If you are expecting the XMLNSC parser which, by design, produces well formed XML, to produce bad XML then that is going to be a bit more difficult.
_________________
Regards
John
The pain of low quaility far outlasts the joy of low price.
Back to top
View user's profile Send private message
rock33
PostPosted: Thu Sep 26, 2013 6:05 am    Post subject: Reply with quote

Novice

Joined: 22 Mar 2013
Posts: 12

Thanks jsware for the Explanation.
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 » Parsing '&' in Esql code
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.