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 » delimited fields in xml tag

Post new topic  Reply to topic
 delimited fields in xml tag « View previous topic :: View next topic » 
Author Message
jeeth_m
PostPosted: Mon Aug 18, 2008 7:11 am    Post subject: delimited fields in xml tag Reply with quote

Voyager

Joined: 21 Jan 2002
Posts: 93

Hi,
I have are requirement to parse comma delimited fields within an xml tag.

Input xml tag is going to be:
<Body>
<ModifiedFields>EmpName,EmpID,EmpAddress</ModifiedFields>
</Body>

I have to parse this tag and come up with an output based on occurence of
comma delimited values:

<Body>
<Field>EmpName</Field>
<Field>EmpID</Field>
<Field>EmpAddress</Field>
</Body>

Is there any ESQL funtion which can be used to acheive this?
Regards,
Jeeth
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
jeeth_m
PostPosted: Mon Aug 18, 2008 9:03 am    Post subject: Reply with quote

Voyager

Joined: 21 Jan 2002
Posts: 93

I did some coding to achieve the same.

DECLARE Source CHAR InputRoot.XML.Body.ModifiedFields;
DECLARE DelimiterPos INT 1;
DECLARE Delimiter CHAR ',';
DECLARE COUNT INT 1;

WHILE(DelimiterPos <> 0)

DO
SET DelimiterPos = POSITION(Delimiter IN Source);

IF (DelimiterPos = 0) THEN
SET OutputRoot.XML.Body.Result[COUNT] = Source;
ELSE
SET OutputRoot.XML.Body.Result[COUNT] = SUBSTRING(Source FROM 1 FOR DelimiterPos - 1 );
SET WorkingSource = SUBSTRING(Source FROM DelimiterPos + 1);
END IF;

SET COUNT = COUNT + 1;

END WHILE;

RETURN TRUE;
END;
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
vaibhav_vy
PostPosted: Mon Aug 18, 2008 9:10 pm    Post subject: Reply with quote

Apprentice

Joined: 04 Aug 2008
Posts: 28

Please go through details following below link. It shows how to process messages having delimited subfields.

http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/index.jsp?topic=/com.ibm.etools.mft.doc/ac20400_.htm
Back to top
View user's profile Send private message
vaibhav_vy
PostPosted: Mon Aug 18, 2008 9:16 pm    Post subject: Reply with quote

Apprentice

Joined: 04 Aug 2008
Posts: 28

AFAIK, there is no such ESQL function that will parse the delimited field & return subfields.
(Something like we have StringTokenizer in Java.)
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Aug 21, 2008 3:26 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

It would be a lot easier if the message used a repeating tag instead of a delimited list. I realise that you probably cannot do anything about the input format.

If you only have 3 delimited fields then use ESQL to split the fields.
If the format gets complex, you should create a message set and parse the string using CREATE...PARSE.
Back to top
View user's profile Send private message
dkeister
PostPosted: Thu Aug 21, 2008 7:26 am    Post subject: Reply with quote

Disciple

Joined: 25 Mar 2002
Posts: 184
Location: Purchase, New York

Why not extract the 'payload' from <ModifiedFields> in one node and using Reset Content Descriptor have it parsed with a message set that defines the comma deleted fields?

<ModifiedFields>EmpName,EmpID,EmpAddress</ModifiedFields>
_________________
Dean Keister
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jeeth_m
PostPosted: Wed Aug 27, 2008 7:14 am    Post subject: Reply with quote

Voyager

Joined: 21 Jan 2002
Posts: 93

Hi,
Quote:
If you only have 3 delimited fields then use ESQL to split the fields.



There could be a maximum of 10 fields.

.
Quote:
create a message set and parse the string using CREATE...PARSE.

I dont know how it works.. but will try

Quote:
using Reset Content Descriptor have it parsed with a message set that


RCD is always expensive. atleast that is what i was told. Please correct me if i am wrong
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
dkeister
PostPosted: Wed Aug 27, 2008 11:56 am    Post subject: Reply with quote

Disciple

Joined: 25 Mar 2002
Posts: 184
Location: Purchase, New York

Creating another MRM message set for comma delimited is pretty straight forward.

Can't comment on the performance implications of RCD but I would imagine the size of the file being parsed would be the major variable. Hopefully some smart person will enlighten us.
_________________
Dean Keister
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » delimited fields in xml 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.