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 » requirement is to parse XML message containin CDATA tag

Post new topic  Reply to topic
 requirement is to parse XML message containin CDATA tag « View previous topic :: View next topic » 
Author Message
satyasecret
PostPosted: Wed Apr 24, 2013 4:34 am    Post subject: requirement is to parse XML message containin CDATA tag Reply with quote

Newbie

Joined: 24 Apr 2013
Posts: 1

Hi,

I am looking for the best method for parsing an incoming XML message that contains a CDATA tag.


The XML example below shows what is currently being saved:



Code:
<ReRegisterResponse xmlns="URL">
- <RegisterResult>
  <Filename>xyz.130417.0315.0001.xml</Filename>
  <Xml><?xml version="1.0" encoding="utf-16"?><Message><Sale ID="130417.0315" timestamp="2013-04-17T15:15:40"><TillPurchaseList><TillPurchase><UniqueSaleId></UniqueSaleId><RegistrationCode>XYZ-202-4323</RegistrationCode><Policy>XYZ.CODE</Policy><Price></Price><TransactionTimeStamp>2013-04-16T11:32:00</TransactionTimeStamp><StoreNo></StoreNo><Retailer></Retailer></TillPurchase><TillPurchase><UniqueSaleId></UniqueSaleId><RegistrationCode>XX-AC-061-1109</RegistrationCode><Policy>XYZ</Policy><Price></Price><TransactionTimeStamp>2013-04-16T15:39:00</TransactionTimeStamp><StoreNo></StoreNo><Retailer></Retailer></TillPurchase><TillPurchase><UniqueSaleId></UniqueSaleId><RegistrationCode>XX-AC-062-1109</RegistrationCode><Policy>XYZ</Policy><Price></Price><TransactionTimeStamp>2013-04-16T11:28:00</TransactionTimeStamp><StoreNo></StoreNo><Retailer></Retailer></TillPurchase></TillPurchaseList></Sale></Message></Xml>
  <Success>true</Success>
  </RegisterResult>
  </RegisterResponse>





from the above message I need only message and looks like the following message from the above message.


Code:
<Message><Sale ID="130417.0315" timestamp="2013-04-17T15:15:40"><TillPurchaseList><TillPurchase><UniqueSaleId></UniqueSaleId><RegistrationCode>XYZ-202-4323</RegistrationCode><Policy>XYZ.CODE</Policy><Price></Price><TransactionTimeStamp>2013-04-16T11:32:00</TransactionTimeStamp><StoreNo></StoreNo><Retailer></Retailer></TillPurchase><TillPurchase><UniqueSaleId></UniqueSaleId><RegistrationCode>XX-AC-061-1109</RegistrationCode><Policy>XYZ</Policy><Price></Price><TransactionTimeStamp>2013-04-16T15:39:00</TransactionTimeStamp><StoreNo></StoreNo><Retailer></Retailer></TillPurchase><TillPurchase><UniqueSaleId></UniqueSaleId><RegistrationCode>XX-AC-062-1109</RegistrationCode><Policy>XYZ</Policy><Price></Price><TransactionTimeStamp>2013-04-16T11:28:00</TransactionTimeStamp><StoreNo></StoreNo><Retailer></Retailer></TillPurchase></TillPurchaseList></Sale></Message>




Could you please help me what to be added/changed in the ESQL code? or give me any example code.


Thanks for your help in advance....
Back to top
View user's profile Send private message
smdavies99
PostPosted: Wed Apr 24, 2013 5:08 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Welcome to the wonderful world of Message Broker (or whatever it is called this week)

The search function is a very useful tool. This question has probably been asked before so why not head over to the upper Right of the screen and try a search to see if anything similar has been asked before
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Wed Apr 24, 2013 5:29 am    Post subject: Re: requirement is to parse XML message containin CDATA tag Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

I do not see a CDATA-Section there (is this defined in the/an XSD?)

Anyway: You need 2 queues (one InputQueue and one OutputQueue) and a flow with MQInput->ESQLCompute->MQOutput.

Code:
<ReRegisterResponse xmlns="URL">
 <RegisterResult>
  <Filename>xyz.130417.0315.0001.xml</Filename>
  <Xml>
    <?xml version="1.0" encoding="utf-16"?>
    <Message>...</Message>
  </Xml>
  <Success>true</Success>
  </RegisterResult>
</RegisterResponse>


-->

Code:
<Message>...</Message>


Configure "XMLNSC" in the "MQInputNode > Input Message Parsing > Message domain" (and leave the other properties emtpy).

Then use an ESQLCompute-Node with the following Code:

Code:
CALL CopyMessageHeaders();
SET OutputRoot.XMLNSC = InputRoot.XMLNSC.ReRegisterResponse.RegisterResult.Xml;
RETURN TRUE;

_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Apr 25, 2013 2:08 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

@satyasecret: you need to explain your problem more carefully. If you take time to do that, then you might find that you realise what the answer is while writing down the question.
@mqsiuser: where did you get the idea that satyasecret needs MQ queues?
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Thu Apr 25, 2013 2:34 am    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

kimbert wrote:
@mqsiuser: where did you get the idea that satyasecret needs MQ queues?

It is just an example. satyasecret can also use other Input/Output/Reply-Nodes.
_________________
Just use REFERENCEs
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 » requirement is to parse XML message containin CDATA tag
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.