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 issue on XML field value containing '

Post new topic  Reply to topic
 Parsing issue on XML field value containing ' « View previous topic :: View next topic » 
Author Message
Nikhil S Rao
PostPosted: Tue Aug 21, 2012 2:33 am    Post subject: Parsing issue on XML field value containing ' Reply with quote

Newbie

Joined: 21 Aug 2012
Posts: 2

In Broker , while parsing the XML message using XMLNSC parser , is there any way to stop the Broker to interpret ' as Single Quote " ' " ?
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Aug 21, 2012 2:40 am    Post subject: Re: Parsing issue on XML field value containing ' Reply with quote

Grand High Poobah

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

Nikhil S Rao wrote:
In Broker , while parsing the XML message using XMLNSC parser , is there any way to stop the Broker to interpret ' as Single Quote " ' " ?


No, because in XML (any XML, not just WMB's parser) that markup represents a single quote.

A better question is why you would want or need to do this. There's no good reason I can think of.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Nikhil S Rao
PostPosted: Tue Aug 21, 2012 2:55 am    Post subject: Reply with quote

Newbie

Joined: 21 Aug 2012
Posts: 2

In Broker , I am performing Substring operation to 1333character on XML field = Description.
Everything works fine on Substring operation if there are no characters like '
When Application system reads the Broker transformed message , they get Description field having character length more than 1333 characters . The reason is this Single quote will be converted back to ' thus causing the character length more than 1333 characters .
I dont want to handle this issue using replace function . Is there any way to handle this issue in message set by making Broker not interpreting &apos as Single quote " ' " while parsing
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Aug 21, 2012 4:09 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You are failing to understand that it is the requirements of the XML specification that ' must be turned into &apos.

And whoever is reading this is failing to support the XML specification by transforming &apos back into '.

All that said, you should be treating fixed width data as a cdata section.

But again, this requires that everyone involved understand and use XML according to the XML specifications!
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Aug 21, 2012 4:51 am    Post subject: Reply with quote

Grand High Poobah

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

Nikhil S Rao wrote:
The reason is this Single quote will be converted back to ' thus causing the character length more than 1333 characters .


Here is the problem. Any XML parser which conforms to the W3C specification for XML will automatically convert ' back into "'" when it parses the document, causing the length to shrink by 4 characters. Clearly whatever is being used to read this doesn't conform.

Nikhil S Rao wrote:
I dont want to handle this issue using replace function . Is there any way to handle this issue in message set by making Broker not interpreting &apos as Single quote " ' " while parsing


If you do not have the "'" escaped to ' then you can't write the XML out of WMB. Even if you "fix" this in the code with replace or otherwise, when you write out the finished string into an XML document WMB will escape this into '

Because it is not valid to have a "'" character in an XML document

You need to understand what XML is and what you're doing. So does whoever's consuming this by simply reading it like a flat file & looking for the description.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Aug 21, 2012 12:01 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

In case there is any doubt, Vitor and mqjeff are correct. XMLNSC is doing the only thing that it *can* do, as a proper XML processor.
Quote:
In Broker , I am performing Substring operation to 1333character on XML field = Description
What exactly is your message flow doing ( what is the input format, and why do you need to use substring) ?
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 issue on XML field value containing '
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.