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 » Extract XML Message from CDATA

Post new topic  Reply to topic
 Extract XML Message from CDATA « View previous topic :: View next topic » 
Author Message
rakk
PostPosted: Sat Oct 15, 2011 10:44 am    Post subject: Extract XML Message from CDATA Reply with quote

Newbie

Joined: 15 Oct 2011
Posts: 3

Hi,
I have a message as below :

<GetFormResponse xmlns="xxxx">
<GetFormResult><![CDATA[<?xml version="1.0"?>
<ResponseData xmlns:xsd="org/2001/XMLSchema" xmlns:xsi="">
<ResponseCode>0</ResponseCode>
<ResponseXML><PFRECORDSET>
<GetTRANSACTIONFORM>
<T_INDEX>000</T_INDEX>
<DESCRIPTION>TESTING</DESCRIPTION>
</GetTRANSACTIONFORM>
</ResponseXML>
</ResponseData>]]>
</GetFormResult>
</GetFormResponse>


I want to extract the xml data present in <GetFormResult> field which is actually in a CDATA. Can anyone please help me how can i do that. I read many articles on this forum but still I am not sure how would i do that.
Back to top
View user's profile Send private message
kimbert
PostPosted: Sat Oct 15, 2011 11:48 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I don't think you mean exactly what you said. The XML is sitting right there, as the value of the GetFormResult syntax element in your message tree.

What you want to do is *parse* that XML and get an XMLNSC message tree from it. This question has been asked many times on this forum. You need to CREATE a new syntax element somewhere, and tell it to create its value by PARSEing using the XMLNSC parser. And don't forget to supply the correct properties and options to the parser when you construct your CREATE statement.

I expect you have already seen several threads on this forum that give the answer - now you should be able to recognize them.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Sat Oct 15, 2011 11:49 am    Post subject: Re: Extract XML Message from CDATA Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

rakk wrote:
I read many articles on this forum but still I am not sure how would i do that.

Be specific.

Which threads on this forum have you read?

what did they say?
What confused you about them?

What is the current code you have, that is not working?

What is the error message you are receiving from that code, or the incorrect data you are receiving from that code, that makes you believe that your current code is not working?
Back to top
View user's profile Send private message
rakk
PostPosted: Mon Oct 17, 2011 6:09 pm    Post subject: Reply with quote

Newbie

Joined: 15 Oct 2011
Posts: 3

My apologies for incomplete info but i would like to show here the code how I extracted the XML within CDATA and then copied all that XML again to a CDATA element of my response.

-- this GetFormResult contain the XML in CDATA. Copied that into temp variable
SET Environment.variable.data = OutputRoot.XMLNSC.GetFormResponse.GetFormResult;


CREATE LASTCHILD OF Environment.Variable.XMLMessage DOMAIN ('XMLNSC') PARSE (Environment.variable.data CCSID 1200);


-- Set the CDATA XML into CDATA field of my response field
SET OutputRoot.XMLNSC."form-reply".(XMLNSC.CDataField)template_info = CAST(ASBITSTREAM(Environment.Variable.XMLMessage) AS CHAR CCSID 437);
Back to top
View user's profile Send private message
rakk
PostPosted: Mon Oct 17, 2011 6:19 pm    Post subject: Reply with quote

Newbie

Joined: 15 Oct 2011
Posts: 3

Now, I am facing a new problem when russian language characters are present in XML within CDATA.

In my previous code example I pasted above, below statement when executed for russian characters gives me an exception saying
XML Writing Errors have occurred, Unconvertable character

this is the code statement. this works when xml contains all english characters.
SET OutputRoot.XMLNSC."form-reply".(XMLNSC.CDataField)template_info = CAST(ASBITSTREAM(Environment.Variable.XMLMessage) AS CHAR CCSID 437);


Can you please tell me what do i need to do inorder to extract the whole XML( containing russian characters) and assign it to my response field which again is a CDATA field.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Oct 17, 2011 7:10 pm    Post subject: Reply with quote

Grand High Poobah

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

your target CCSID is 437, but this CCSID will not cater for / allow russian characters. Try setting the output and the CDATA in CCSID 1208 (UTF-8 ). This should do the trick.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Extract XML Message from CDATA
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.