Author |
Message
|
narki |
Posted: Tue Jun 27, 2006 6:06 pm Post subject: XML declaration in MRM |
|
|
Acolyte
Joined: 19 Dec 2005 Posts: 67
|
I am using WMB 6.0. I have a message set with MRM parser and XML wire format . I want to out put an XML message with following xml declaration <?xml version="1.0" encoding="UTF-8">. Please suggest how to get it.
Thanks
Naren |
|
Back to top |
|
 |
mqmaniac |
Posted: Tue Jun 27, 2006 6:10 pm Post subject: |
|
|
 Master
Joined: 27 Dec 2005 Posts: 201
|
SET OutputRoot.XML.(XML.XmlDecl)='';
SET OutputRoot.XML.(XML.XmlDecl).(XML.Version)='1.0';
SET OutputRoot.XML.(XML.XmlDecl).(XML."Encoding")='UTF-8';
Use this before/after the System enerated ESQL |
|
Back to top |
|
 |
narki |
Posted: Tue Jun 27, 2006 6:32 pm Post subject: |
|
|
Acolyte
Joined: 19 Dec 2005 Posts: 67
|
Hi mqmaniac,
Use this before/after the System enerated ESQL.
As I told you that Parser is MRM . So watever you have suggested will fail. So if I do this in MRM domain
SET OutputRoot.MRM.(XML.XmlDecl)='';
SET OutputRoot.MRM.(XML.XmlDecl).(XML.Version)='1.0';
SET OutputRoot.MRM.(XML.XmlDecl).(XML."Encoding")='UTF-8';
It is also failing. If I misunderstood you please correct me. |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jun 27, 2006 6:51 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Make sure your message set in MRM has an XML wire format.
On the wire format you should find some indication about suppressing the xml header or not which is exactly what you need.
The next thing you need to look at is how the code will behave once you have switched from CWF1 to XML1 for the wire format.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
narki |
Posted: Tue Jun 27, 2006 7:02 pm Post subject: |
|
|
Acolyte
Joined: 19 Dec 2005 Posts: 67
|
Hi,
Yes there is message set property SUPPRESS XML DeCLARATION. If I check this box I hope I will not be getting any xml declration. IF do not chek this then there is some encoding propety. In the encoding property either i can select NULL or USE TExt(Not sure about exact name). If I select NULL the XML header will come withot any encoding. IF other property i selected then it will be some thing like '..ibm..' (not sure about exat encoding name)come in the encoding property. But I want encoding to be set as "UTF-8".
Thanks
Naren |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jun 27, 2006 7:08 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
SET OutputRoot.MRM.(XML.XmlDecl).(XML."Encoding")='UTF-8';
Have you tried it? At the same time you should set your CCSID to 1208...
Enjoy _________________ MQ & Broker admin |
|
Back to top |
|
 |
narki |
Posted: Tue Jun 27, 2006 7:16 pm Post subject: |
|
|
Acolyte
Joined: 19 Dec 2005 Posts: 67
|
|
Back to top |
|
 |
kimbert |
Posted: Wed Jun 28, 2006 12:33 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
fjb_saper: narki already said that he is using the MRM parser with an XML wire format. He cannot use the ESQL which you suggested because that only works with the XMLNS/XMLNSC parsers - MRM XML is different. |
|
Back to top |
|
 |
shalabh1976 |
Posted: Wed Jun 28, 2006 1:16 am Post subject: |
|
|
 Partisan
Joined: 18 Jul 2002 Posts: 381 Location: Gurgaon, India
|
This may not be good way to do this but you can always do BLOB concatenation. _________________ Shalabh
IBM Cert. WMB V6.0
IBM Cert. MQ V5.3 App. Prog.
IBM Cert. DB2 9 DB Associate |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jun 28, 2006 2:25 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
But I want encoding to be set as "UTF-8" |
The docs say that if you select 'As document text', then the broker will automatically generate a correct Encoding attribute for the document. Is it possible that the '..ibm..' value which you are getting is correct, even though it was not what you expected? |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jun 28, 2006 3:03 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
kimbert wrote: |
fjb_saper: narki already said that he is using the MRM parser with an XML wire format. He cannot use the ESQL which you suggested because that only works with the XMLNS/XMLNSC parsers - MRM XML is different. |
You mean to say that
Quote: |
The ability to add the Encoding attribute to the xmldecl for an MRM XML output message was added in WMB V6. Also the ability to set the version to '1.1'. |
from http://www.mqseries.net/phpBB2/viewtopic.php?t=23003&highlight=encoding is false?
No encoding xmldecl in V6 MRM? Or does that mean that you can only have the automatically generated one based on the CCSID.
So setting the CCSID of the message to 1208 should do the trick. Right ? _________________ MQ & Broker admin |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jun 29, 2006 12:30 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
This controls whether an encoding attribute is written in the generated XML declaration.
If Null is selected, no encoding attribute is written in the XML declaration of the output XML document.
If As document text is selected, an encoding attribute will be generated which is consistent with the text in the XML document.
The default is Null.
If you set Suppress XML Declaration to Yes, this property is ignored. |
No, I am not saying that the above statement from the docs is false. In v5 there was no way at all to generate an encoding attribute in MRM XML. In v6, you can ask the MRM writer to insert an encoding attribute which fits the output XML document. So the docs are correct:
Quote: |
Or does that mean that you can only have the automatically generated one based on the CCSID. So setting the CCSID of the message to 1208 should do the trick. Right ? |
Correct
Also, please bear in mind that constants like XML.Encoding, XML.Attribute etc have no meaning when they are applied to a message tree which si owned by the MRM parser. |
|
Back to top |
|
 |
danielmax |
Posted: Thu Jul 06, 2006 1:31 pm Post subject: You can make this work with an RCD |
|
|
Newbie
Joined: 06 Jul 2006 Posts: 1 Location: Floater
|
This is terribly inefficient, but effective:
You're using an MRM with an XML wire format, right?
Supress the declaration from the message set.
Compute Node (MRM) -> RCD (to XML) -> Compute Node (XML) -> MQ Output...
Compute Node (in MRM format) -->
Reset Content Descriptor (to XML) -->
Compute Node (add the XML Declaration)
SET OutputRoot.XML.(XML.XmlDecl)='';
SET OutputRoot.XML.(XML.XmlDecl).(XML.Version)='1.0';
SET OutputRoot.XML.(XML.XmlDecl).(XML."Encoding")='UTF-8';
and voila - you've got your MRM-formatted message with a valid XML header on it. |
|
Back to top |
|
 |
|