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 » & getting converted to & in message broker

Post new topic  Reply to topic
 & getting converted to & in message broker « View previous topic :: View next topic » 
Author Message
Frnd
PostPosted: Mon Sep 05, 2011 1:02 am    Post subject: & getting converted to & in message broker Reply with quote

Apprentice

Joined: 04 Jun 2007
Posts: 33

Hi All,

Request your inputs on the below issue.

While parsing a message flow that contains an element value 'Johnson & Johnson, message broker is converting it to 'Johnson & Johnson'.The input message parser is XMLNSC with Validation type - Content and Value. The input node also refers to a message set where this element is defines as a string.The special character gets converted right after the input node itself.Is there any setting that can be done to ensure Message broker does not convert this special character to & which is an invalid XML content..
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Sep 05, 2011 2:49 am    Post subject: Re: & getting converted to & in message broker Reply with quote

Grand High Poobah

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

Frnd wrote:
Hi All,

Request your inputs on the below issue.

While parsing a message flow that contains an element value 'Johnson & Johnson, message broker is converting it to 'Johnson & Johnson'.The input message parser is XMLNSC with Validation type - Content and Value. The input node also refers to a message set where this element is defines as a string.The special character gets converted right after the input node itself.Is there any setting that can be done to ensure Message broker does not convert this special character to & which is an invalid XML content..


Parsing 101. Special XML characters are converted back to normal when reading the value of the tag.
Working as expected.
They will get serialized back to a special character during the serializing process.

What happens when you assign "Johnson & Johnson" to an XML document node value and write (serialize) said document?

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Frnd
PostPosted: Mon Sep 05, 2011 8:48 pm    Post subject: Reply with quote

Apprentice

Joined: 04 Jun 2007
Posts: 33

Quote:

What happens when you assign "Johnson & Johnson" to an XML ?


Hi fjb_saper,

thanks for the response..when i assign "Johnson & Johnson" to an XML, it failed..guess it was working as expected..

Thank you
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Sep 06, 2011 4:46 am    Post subject: Reply with quote

Grand High Poobah

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

Frnd wrote:
it failed..guess it was working as expected..




For the record and largely for the benefit of future readers: this is not a broker behaviour. The string "Johnston & Johnston" is not allowed in any XML document but must be "Johnston &amp Johnston". Competent XML parsers know that's not what the data is supposed to look like and change the &amp back to an & when parsing in, and back to &amp when writing out.

One of the things you're paying good money to an XML parser for is so you don't need to worry about such things.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Sep 06, 2011 1:43 pm    Post subject: Reply with quote

Grand High Poobah

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

Frnd wrote:
Quote:

What happens when you assign "Johnson & Johnson" to an XML ?


Hi fjb_saper,

thanks for the response..when i assign "Johnson & Johnson" to an XML, it failed..guess it was working as expected..

Thank you

I did not say to assign to the XML but to the XML Document node value !
These are 2 different things, entirely!

The supposition here is that you know how to work the XML DOM model...


_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
adubya
PostPosted: Tue Sep 06, 2011 11:27 pm    Post subject: Reply with quote

Partisan

Joined: 25 Aug 2011
Posts: 377
Location: GU12, UK

fjb_saper wrote:
Frnd wrote:
Quote:

What happens when you assign "Johnson & Johnson" to an XML ?


Hi fjb_saper,

thanks for the response..when i assign "Johnson & Johnson" to an XML, it failed..guess it was working as expected..

Thank you

I did not say to assign to the XML but to the XML Document node value !
These are 2 different things, entirely!

The supposition here is that you know how to work the XML DOM model...



Yes, I was surprised when the OP said your suggestion didn't work.
Back to top
View user's profile Send private message Send e-mail
rekarm01
PostPosted: Wed Sep 07, 2011 12:08 am    Post subject: Re: & getting converted to & in message broker Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

Frnd wrote:
when i assign "Johnson & Johnson" to an XML, it failed.

Please explain more clearly what the message flow is doing, and how it fails.

The XML standard requires escaping certain characters (like '&') with predefined entities (like '&') in an unparsed XML message (that is before the input node, and after the output node). Within the message flow however, when copying the elements of the input XML message into the parsed message tree, the XML parser replaces '&' with '&', and when copying the contents of the parsed message tree to an output XML message, the XML parser replaces '&' with '&'.
Back to top
View user's profile Send private message
rglack10
PostPosted: Thu Sep 08, 2011 6:04 am    Post subject: Reply with quote

Apprentice

Joined: 06 Jul 2011
Posts: 34

a bit of a random reply but you can use CDATA section in well-formed XML to handle non-standard characters if you so wish however you may have issues in a message flow extracting incorrectly formatted XML for example or something like control characters in mixed text etc..

I don't want to start a thread war with the crusaders out there.. I am mainly replying due to boredom..
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 » & getting converted to & in message broker
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.