Author |
Message
|
Nikhil S Rao |
Posted: Tue Aug 21, 2012 2:33 am Post subject: Parsing issue on XML field value containing ' |
|
|
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 |
|
 |
Vitor |
Posted: Tue Aug 21, 2012 2:40 am Post subject: Re: Parsing issue on XML field value containing ' |
|
|
 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 |
|
 |
Nikhil S Rao |
Posted: Tue Aug 21, 2012 2:55 am Post subject: |
|
|
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 |
|
 |
mqjeff |
Posted: Tue Aug 21, 2012 4:09 am Post subject: |
|
|
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 |
|
 |
Vitor |
Posted: Tue Aug 21, 2012 4:51 am Post subject: |
|
|
 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 |
|
 |
kimbert |
Posted: Tue Aug 21, 2012 12:01 pm Post subject: |
|
|
 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 |
|
 |
|