Author |
Message
|
jfluitsm |
Posted: Wed May 15, 2002 6:40 am Post subject: Problems with escaped characters |
|
|
Disciple
Joined: 24 Feb 2002 Posts: 160 Location: The Netherlands
|
We have a problem with escaped characters in XML.
Escaped characters in an input XML-message are translated to their character representation in the broker without any problem.
In the output XML message however these are still the character representation instead of being escaped again.
As this is invalid XML the receiving applications fails when trying to parse the message.
Do I something wrong or is this a bug in the parser? _________________ Jan Fluitsma
IBM Certified Solution Designer WebSphere MQ V6
IBM Certified Solution Developer WebSphere Message Broker V6 |
|
Back to top |
|
 |
kirani |
Posted: Wed May 15, 2002 5:40 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Jan,
Posting an example input/output message with ESQL code in compute node would be helpful in debugging the problem. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
jfluitsm |
Posted: Wed May 15, 2002 10:59 pm Post subject: |
|
|
Disciple
Joined: 24 Feb 2002 Posts: 160 Location: The Netherlands
|
Kiran,
Here the example.
MQInput(XML) -> Compute -> MQOutput
In Compute node:
set OutputRoot.XML.Message.NewData = InputBody.Message.Data;
Input XML:
<Message><Data>Test-Ç</Data></Message>
Output XML:
<Message><NewData>Test-Ç</NewData></Message>
The Ç is not allowed in XML and should be Ç. |
|
Back to top |
|
 |
Segs |
Posted: Thu May 16, 2002 6:17 am Post subject: |
|
|
Voyager
Joined: 04 Oct 2001 Posts: 78 Location: Zurich Financial Services
|
Try using the elementasis function, I've had quite a few problems trying to achieve simliar functionality. |
|
Back to top |
|
 |
kirani |
Posted: Thu May 16, 2002 7:28 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Jan,
try this,
Set OutputRoot.XML.(XML.Element)Message.(XML.Element)NewData.(XML.AsisElementContent) = InputBody.Message.Data; _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
jfluitsm |
Posted: Mon Aug 26, 2002 7:28 am Post subject: |
|
|
Disciple
Joined: 24 Feb 2002 Posts: 160 Location: The Netherlands
|
Excuses for the late reply, more pressing problems prevented me to work on this one.
The problem is solved and was all in the CCSID's. Before going into detail first some warnings.
***WARNING***
1) When a xml-message is parsed by a commercial parser make sure to use the correct CCSID in the put and get of the message, mostly this will be 1208 (UTF-8).
2) When creating a test message with a windows-editor (like notepad), (a) make sure to put the message on the queue with CCSID 1252 as this is the characterset in which the message is stored on disk, CCSID 437 or 850 (or any other depending on the locale settings) are only used for the keyboard, (b) make sure to use only characters that excists in CCSID 1252 (no box-drawing characters) or (c) store the message as unicode, use CCSID 1200 (UCS-2) and only use the UCS-2 compatible unicode characters (MQSIPUT can't handle unicode files).
***END WARNING***
We had problems with special characters in combination with legacy messages and xml message (legacy to xml and vv) jumping into the conclusion that spacial characters aren't allowed in xml and should be escaped.
As stated before the problem wasn't xml or WMQI, it was all in used CCSID's.
The xml-messages were written and parsed using a commerial available xml-writer/parser (Lotus Notes), these messages are in or expected to be in UTF-8 (CCSID 1208), but they were put on and gotten from the queue with CCSID 437 or 850, so either the character conversion made a mess of the message (xml in), or the xml-parser couldn't understand the contents (xml out). Using the correct CCSID's solved the problem.
I would have discoverd this earlier if there wasn't a simular problem with the test messages for MQSIPUT, these were also put to the queue with CCSID 437, the special characters were enterd into the file with alt+nnn, the correct number for the character in CCSID 437. What I didn't know then is that the files made with a windows editor like notepad are stored in CCSID 1252 (alt+128 = 0x80 in 437 is stored on disc as 0xC7 in 1252, which is the correct character), so also these messages were put with the wrong CCSID.
Thnx for the reactions. _________________ Jan Fluitsma
IBM Certified Solution Designer WebSphere MQ V6
IBM Certified Solution Developer WebSphere Message Broker V6 |
|
Back to top |
|
 |
lung |
Posted: Tue Aug 27, 2002 1:50 am Post subject: |
|
|
 Master
Joined: 27 Aug 2002 Posts: 291 Location: Malaysia
|
Is there a list somewhere that lists down all these special characters together with their escapes?
Thanks.  _________________ lung |
|
Back to top |
|
 |
miron |
Posted: Tue Aug 27, 2002 3:07 am Post subject: |
|
|
Apprentice
Joined: 27 Jun 2002 Posts: 39 Location: New York
|
There are 5 predefined entity references in XML:
< < less than
> > greater than
& & ampersand
' ' apostrophe
" " quotation mark
Entity references always start with the "&" character and end with the ";" character.
Note: Only the characters "<" and "&" are strictly illegal in XML. Apostrophes, quotation marks and greater than signs are legal, but it is a good habit to replace them.
http://www.w3schools.com/xml/xml_cdata.asp |
|
Back to top |
|
 |
lung |
Posted: Tue Aug 27, 2002 4:47 pm Post subject: |
|
|
 Master
Joined: 27 Aug 2002 Posts: 291 Location: Malaysia
|
Thanks!
 _________________ lung |
|
Back to top |
|
 |
lung |
Posted: Tue Aug 27, 2002 4:47 pm Post subject: |
|
|
 Master
Joined: 27 Aug 2002 Posts: 291 Location: Malaysia
|
Thanks!
 _________________ lung |
|
Back to top |
|
 |
|