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 » adding name space declaration in cdata section.

Post new topic  Reply to topic
 adding name space declaration in cdata section. « View previous topic :: View next topic » 
Author Message
sravan
PostPosted: Tue Aug 23, 2011 4:44 pm    Post subject: adding name space declaration in cdata section. Reply with quote

Centurion

Joined: 02 Apr 2010
Posts: 104
Location: Charlotte

currently I have an XML in which I am declaring a cdata section as below.
I am unable to add the name space declaration <?xml version="1.0"?>
in the cdata section.Please give some idea about this.I want

<REQUEST_DOCUMENT_CLOB_DATA>
<![CDATA[
<?xml version="1.0"?>
<REQUEST_VARIABLE_DATA>

current XML with CData section is below.

<REQUEST_DOCUMENT_CLOB_DATA>
<![CDATA[
<REQUEST_VARIABLE_DATA>
<VARIABLE_DATA_TXT>
<VARIABLE_DATA>
<CHECK_DATE>01/01/2011</CHECK_DATE>
<CLIENT_SERVICES_NAME>Fidelity HR Solutions
</CLIENT_SERVICES_NAME>
<CLIENT_SERVICES_PHONE_NUMBER>800-835-5099
</CLIENT_SERVICES_PHONE_NUMBER>
</VARIABLE_DATA>
</VARIABLE_DATA_TXT>
</REQUEST_VARIABLE_DATA>]]>
</REQUEST_DOCUMENT_CLOB_DATA>
_________________
skr_wmb
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Aug 23, 2011 7:48 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

AFAIK you're only allowed 1 XML declaration per document (<?xml version="1.0" ?>)...
So if you need to add this to a Cdata field, you might have to assign the Cdata field to a variable, parse it in the environment (assigning a parser domain) add the declaration and use ASBITSTREAM to get back to the string for the Cdata. Finally replace the Cdata with the new string...

A lot of work... might be simpler to just concatenate the declaration with the Cdata existing content and put it back into cdata...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Wed Aug 24, 2011 1:19 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

It is illegal for an xml document to have more than one <xml declaration in it.

You should base64 encode your payload, if you wish to preserve it's contents without it being subject to the XML parsing rules - including what legal characters are.
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Aug 24, 2011 2:08 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

The contents of a CDATA section are not parsed by the XML parser, so a CDATA section is allowed to contain an XML declaration. As far as the XML parser is concerned, it is not 'another XML declaration'. It's just 'character data'.

I agree with fjp_saper: unless you are already using XMLNSC to write the contents of the CDATA section, just use string concatenation.

mqjeff is correct about the limitations of CDATA - base64 encoding is the only way to *guarantee* that the contents of the CDATA section will parse successfully.
Back to top
View user's profile Send private message
sravan
PostPosted: Wed Aug 24, 2011 5:28 am    Post subject: Reply with quote

Centurion

Joined: 02 Apr 2010
Posts: 104
Location: Charlotte

Thanks guys It worked by adding the declaration as a string.
_________________
skr_wmb
Back to top
View user's profile Send private message
sravan
PostPosted: Wed Aug 24, 2011 5:29 am    Post subject: Reply with quote

Centurion

Joined: 02 Apr 2010
Posts: 104
Location: Charlotte

DECLARE MessageMsgBlob BLOB ASBITSTREAM(OutputRoot.XMLNSC.Out.MESSAGE.MESSAGE_DOCUMENT_CLOB_DATA.MESSAGE_VARIABLE_DATA
OPTIONS FolderBitStream);
DECLARE MessageMsgChar CHAR
CAST(MessageMsgBlob AS CHAR CCSID InputRoot.Properties.CodedCharSetId );
c
-- Create Message CData Section out of XML.
SET OutputRoot.XMLNSC.Out.MESSAGE.MESSAGE_DOCUMENT_CLOB_DATA = NULL;
--concatenate strings to add name space declaration.
SET MessageMsgChar = NamespaceMsgChar||MessageMsgChar;
SET OutputRoot.XMLNSC.Out.MESSAGE.MESSAGE_DOCUMENT_CLOB_DATA.(XML.CDataSection)= MessageMsgChar;
_________________
skr_wmb
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Aug 24, 2011 5:36 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

sravan wrote:
SET OutputRoot.XMLNSC.Out.MESSAGE.MESSAGE_DOCUMENT_CLOB_DATA.(XML.CDataSection)= MessageMsgChar;


This is wrong.

Use XMLNSC.CDataField.
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Aug 24, 2011 6:11 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
SET OutputRoot.XMLNSC.Out.MESSAGE.MESSAGE_DOCUMENT_CLOB_DATA.(XML.CDataSection)= MessageMsgChar;
Never, ever use XML.anything with XMLNSC. It is *always* wrong. Please read this: http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/topic/com.ibm.etools.mft.doc/ac67192_.htm

If you want to put something into a CData section using XMLNSC, then please refer to this: http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/topic/com.ibm.etools.mft.doc/ac67174_.htm
Back to top
View user's profile Send private message
sravan
PostPosted: Wed Aug 24, 2011 6:27 am    Post subject: Reply with quote

Centurion

Joined: 02 Apr 2010
Posts: 104
Location: Charlotte

Thanks for teh suggestions,I made the change.
_________________
skr_wmb
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 » adding name space declaration in cdata section.
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.