Author |
Message
|
Jonah3 |
Posted: Wed Aug 23, 2006 7:41 am Post subject: XML issue |
|
|
Newbie
Joined: 22 Aug 2006 Posts: 8
|
Some XML predefined entities & ' " <> will been replaced by & ... automaticly.
How could I make messages keeping & <> ' " in literal form?
Because XML attribute value has legal ' > . I want to keep the original message format. |
|
Back to top |
|
 |
Jonah3 |
Posted: Wed Aug 23, 2006 7:43 am Post subject: |
|
|
Newbie
Joined: 22 Aug 2006 Posts: 8
|
|
Back to top |
|
 |
Vitor |
Posted: Wed Aug 23, 2006 7:44 am Post subject: Re: XML issue |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Jonah3 wrote: |
Some XML predefined entities & ' " <> will been replaced by & ... automaticly.
How could I make messages keeping & <> ' " in literal form?
Because XML attribute value has legal ' > . I want to keep the original message format. |
AFAIK W3C standard forbids those characters except in CDATA sections. If they've been escaped into &, <, etc by the broker's parser they should be presented to the application as the original characters when parsed by it's XML parser.
What version of broker are you using?
Conflicting opinions welcomed. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
madi |
Posted: Wed Aug 23, 2006 8:01 am Post subject: |
|
|
 Chevalier
Joined: 17 Jan 2006 Posts: 475
|
i think there is way to escape these characters ....... i cannot find the information though .......... i know ive done it before ....... you will have to take the message in blob and convert it into a string ...... find the characters and escape them .
then you can change it back to xml and process it normally
will post more information if i can find any
--madi |
|
Back to top |
|
 |
kimbert |
Posted: Wed Aug 23, 2006 8:24 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
More details please.
1. What are you trying to do?
2. Where are you seeing these entities ( & > ...). In the message tree? |
|
Back to top |
|
 |
Jonah3 |
Posted: Thu Aug 24, 2006 2:28 am Post subject: |
|
|
Newbie
Joined: 22 Aug 2006 Posts: 8
|
Message content : <A name="as'>ds"/>
Simple test flow:MQINPUT + ComputeNode + MQOUTPUT
Computernode just copy entire message.
Output is <A name="as'>ds"/>
Complex flow MQINPU + ComputeNode1+ DSTXNode+ ComputeNode2 +MQOUPUT
ComputeNode 1 code is
SET OutputRoot.BLOB.BLOB = CAST(InputRoot.XMLNS.*[] AS BLOB CCSID 1208 ENCODING MQENC_INTEGER_NORMAL);
ComputeNode 2 code is
DECLARE inputInfo CHARACTER CAST(InputRoot.BLOB.BLOB AS CHAR CCSID InputRoot.MQMD.CodedCharSetId ENCODING InputRoot.MQMD.Encoding);
CREATE LASTCHILD OF Environment DOMAIN('XMLNS') PARSE(transformedMSG,InputRoot.MQMD.Encoding,InputRoot.MQMD.CodedCharSetId);
Then output is
<A name="as'>ds"/>
I want to ask how to make ' > keep in literal form not replaced by WMB |
|
Back to top |
|
 |
Vitor |
Posted: Thu Aug 24, 2006 2:37 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
What parses the output message? To put it another way, what is the parser used by the application that consumes the output XML? Is it objecting to the output XML with an error or similar, and in what way does it fail to recognise < as >?
Also, and to gain an insight into your requirment, why does the attribute contain these characters? I don't see at first glance what the attribute is trying to convey  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Jonah3 |
Posted: Thu Aug 24, 2006 6:37 pm Post subject: |
|
|
Newbie
Joined: 22 Aug 2006 Posts: 8
|
Thank you all.
We have already known that & ' > < " in XML will been replaced by WMB.
It seems that WMB will handle it automaticly.
But a weird case that > has been replace by > and ' not.
I have enquired IBM already.
Update you later
Thanks again |
|
Back to top |
|
 |
Sridar |
Posted: Sun Aug 27, 2006 9:31 pm Post subject: |
|
|
Acolyte
Joined: 14 May 2006 Posts: 72 Location: Chennai, India
|
Hi Jonah3
Any replies from IBM on this.
Though i did not face this problem am interested in knowing. _________________ Thanks and Regards
Sridar |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Aug 28, 2006 2:39 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Jonah3 wrote: |
Thank you all.
We have already known that & ' > < " in XML will been replaced by WMB.
It seems that WMB will handle it automaticly.
But a weird case that > has been replace by > and ' not.
I have enquired IBM already.
Update you later
Thanks again |
Standard w3 XML rules. No sign that would confuse the parser is allowed in the text. It will be escaped...
Your attribute text is 'a''>ds' => a&apos>ds in standard xml on the wire.
Working as designed
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kimbert |
Posted: Mon Aug 28, 2006 5:47 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Standard w3 XML rules |
Is that strictly true? If I read this correctly http://www.w3.org/TR/2006/REC-xml-20060816/#syntax the escaping rules being applied are a little stricter than the standard requires. Most people won't mind that, but Jonah3 may have a valid requirement. Maybe an option on the parser would be useful? |
|
Back to top |
|
 |
Jonah3 |
Posted: Mon Aug 28, 2006 11:47 pm Post subject: |
|
|
Newbie
Joined: 22 Aug 2006 Posts: 8
|
[quote="kimbert"]
Quote: |
Maybe an option on the parser would be useful? |
Any option on the parser ? |
|
Back to top |
|
 |
Vitor |
Posted: Tue Aug 29, 2006 12:31 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
No, I think the current position is the correct one. This part of the specification seems (IMHO) unambiguous:
Quote: |
The ampersand character (&) and the left angle bracket (<) MUST NOT appear in their literal form, except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section. If they are needed elsewhere, they MUST be escaped using either numeric character references or the strings " & " and " < " respectively. The right angle bracket (>) may be represented using the string " > ", and MUST, for compatibility, be escaped using either " > " or a character reference when it appears in the string " ]]> " in content, when that string is not marking the end of a CDATA section. |
So unless these characters appear in a CDATA section or are being used as part of the XML document structure they must be escaped.
fjb_saper wrote: |
Working as designed |
I'm with you on this  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|