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 » Parsing CDATA into XMLNSC

Post new topic  Reply to topic
 Parsing CDATA into XMLNSC « View previous topic :: View next topic » 
Author Message
dmx0t1
PostPosted: Mon Jan 05, 2009 2:25 am    Post subject: Parsing CDATA into XMLNSC Reply with quote

Apprentice

Joined: 23 Nov 2008
Posts: 27

Hi there,

Suppose I have a well-formed xml message wrapped within another well-formed XML message as CDataField, how can I parse the CDataField into the XMLNSC message domain?

With the following message:
Quote:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<EBQRq>
<![CDATA[<?xml version="1.0" encoding="UTF-8"?><Message><ID>johnsmith</ID></Message>]]>
</EBQRq>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


I've tried the following:
Quote:

DECLARE messageBlob BLOB ASBITSTREAM(InputRoot.XMLNSC.soap:Envelope.soap:Body.EBQRq,
InputRoot.Properties.Encoding,
InputRoot.Properties.CodedCharSetId,
'','','',FolderBitStream);

CREATE LASTCHILD OF OutputRoot
DOMAIN ('XMLNSC')
PARSE (messageBlob
CCSID InputRoot.Properties.CodedCharSetId
ENCODING 0
SET 'DR4MHOO002001'
FORMAT 'XML1'
TYPE 'Message');

It seems that I can not get rid of "<![CDATA[]]>" after the message tree is created from the above PARSE statement, any ideas?

Much Thanx in Advance~
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Jan 05, 2009 3:42 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You do not need to use ASBITSTREAM on the CDataSection.
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Jan 05, 2009 3:50 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

mqjeff said:
Quote:
You do not need to use ASBITSTREAM on the CDataSection.
Correct. And you do need to CAST the contents of the CData section to a BLOB before calling CREATE...PARSE. Remember that all character data in the message tree is in UTF16 ( code page 1200 ) so don't use InputRoot.Properties.CodeCharSetId
Back to top
View user's profile Send private message
dmx0t1
PostPosted: Mon Jan 05, 2009 7:08 am    Post subject: Reply with quote

Apprentice

Joined: 23 Nov 2008
Posts: 27

kimbert wrote:
mqjeff said:
Quote:
You do not need to use ASBITSTREAM on the CDataSection.
Correct. And you do need to CAST the contents of the CData section to a BLOB before calling CREATE...PARSE. Remember that all character data in the message tree is in UTF16 ( code page 1200 ) so don't use InputRoot.Properties.CodeCharSetId


u mean something like this?

Code:

DECLARE messageBlob BLOB CAST (InputRoot.XMLNSC.soap:Envelope.soap:Body.EBQRq AS BLOB);

CREATE LASTCHILD OF OutputRoot
DOMAIN ('XMLNSC')
PARSE (messageBlob
CCSID InputRoot.Properties.CodedCharSetId
ENCODING 0
SET 'DR4MHOO002001'
FORMAT 'XML1'
TYPE 'Message');
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Jan 05, 2009 7:51 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

You have made two mistakes:
- When you convert CHARACTER to BLOB you should always specify the code page of the source characters.
- You have ignored my advice about using code page 1200 instead of InputRoot.Properties.CodedCharSetId
Back to top
View user's profile Send private message
dmx0t1
PostPosted: Tue Jan 06, 2009 3:19 am    Post subject: Reply with quote

Apprentice

Joined: 23 Nov 2008
Posts: 27

kimbert wrote:
You have made two mistakes:
- When you convert CHARACTER to BLOB you should always specify the code page of the source characters.
- You have ignored my advice about using code page 1200 instead of InputRoot.Properties.CodedCharSetId


I modified my code as follows:

Code:

      DECLARE messageBlob BLOB CAST(InputRoot.XMLNSC.soap:Envelope.soap:Body.esb:MsgRq.EBQRq AS BLOB CCSID 1208);                  
      
      
      CREATE LASTCHILD OF OutputRoot
           DOMAIN ('XMLNSC')
           PARSE (messageBlob
                  CCSID     1200                 
                  ENCODING  0                  
              SET        'DR4MHOO002001'
                  FORMAT    'XML1'
                  TYPE      'Message');


And after I ran the debugger just passing the DECLARE line, I got "messageBlob:UNKNOWN:null" in the debugger view...I've attempted to convert CHARACTER to BLOB w/ the source ccsid, is there something I am missing?
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Jan 06, 2009 4:28 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

- Why are you using code page 1208? - All character data in the message tree is UTF-16.
- Disconnect the flow debugger and take a user trace. The debugger is useful for most kinds of debugging, but you will not get good diagnostics from the debugger when you encounter parsing errors.
Back to top
View user's profile Send private message
dmx0t1
PostPosted: Thu Jan 08, 2009 3:00 am    Post subject: Reply with quote

Apprentice

Joined: 23 Nov 2008
Posts: 27

It seems there's some line encoding problem w/ my input test message, after I made all messages in the CData section into one single line, everything turned out all right...thanx a lot for the help guys
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Jan 08, 2009 3:26 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Just noticed something else that you should be aware of.
XMLNSC does not use the TYPE and FORMAT parameters. Those are for MRM only. So don't expect the settings in the XML1 physical format to have any effect on the XMLNSC parser!
You should change your code to set those parameters to the empty string.
Back to top
View user's profile Send private message
dmx0t1
PostPosted: Thu Jan 08, 2009 8:01 am    Post subject: Reply with quote

Apprentice

Joined: 23 Nov 2008
Posts: 27

kimbert wrote:
Just noticed something else that you should be aware of.
XMLNSC does not use the TYPE and FORMAT parameters. Those are for MRM only. So don't expect the settings in the XML1 physical format to have any effect on the XMLNSC parser!
You should change your code to set those parameters to the empty string.


gottcha, thanx for the tips
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 » Parsing CDATA into XMLNSC
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.