|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
TDS commad delimited message to XML |
« View previous topic :: View next topic » |
Author |
Message
|
cjvaz |
Posted: Thu Jul 06, 2006 6:54 pm Post subject: TDS commad delimited message to XML |
|
|
Newbie
Joined: 06 Jul 2006 Posts: 3
|
Having issue with converting a TDS message to XML.
DESCRIPTION
I have a comma delimited file (can be one line or multiple lines), each line separated by a <CR><LF>
92833,20050623,5.11.026,PERFGH,SRFG.0,2,008:00,A<CR><LF>
38372,20050625,8.11.028,CERFGJ,ADRF.1,5,999:59,A<CR><LF>
DESIRED OUTPUT in XML format:
<TR_RECS>
<RECORDS>
<TYPE1>92833></TYPE1>
<TYPE2>06-23-2005</TYPE2>
<TYPE3>5.11.026</TYPE3>
<TYPE4>PERFGH</TYPE4>
<TYPE5>SRFG.0</TYPE5>
<TYPE6>2</TYPE6>
<TYPE7>008:00</TYPE7>
<TYPE8>A</TYPE8>
<RECORDS>
<TR_RECS>
MY ISSUE:
works fine with one line of comma separated values, but when I try and push through two records which are separated by <CR><LF>, I get the following XML output:
<TR_RECS>
<RECORDS>
<TYPE1>92833></TYPE1>
<TYPE2>06-23-2005</TYPE2>
<TYPE3>5.11.026</TYPE3>
<TYPE4>PERFGH</TYPE4>
<TYPE5>SRFG.0</TYPE5>
<TYPE6>2</TYPE6>
<TYPE7>008:00</TYPE7>
<TYPE8>A..38372,20050625,8.11.028,CERFGJ,ADRF.1,5,999:59,A</TYPE8>
<RECORDS>
<TR_RECS>
The contents of the second line gets dumped into the last tag.
TDS MESSAGE DESIGN:
1) two messages
a) tr_recs(complextype1)
LOGICAL PROPERTIES of complextype1
composition - "sequence"
content validation - "closed"
min and max occurs is "1"
PHYSICAL PROPERTIES
DES - "all elements delimited"
delimiter - X'0D0A'
supress absent element delimiter - "Never"
b) records(complextype2)
LOGICAL PROPERTIES of complextype2
composition - "sequence"
content validation - "closed"
min and max occurs is "1"
PHYSICAL PROPERTIES
DES - "all elements delimited"
GRoup Terminator - X'0D0A'
delimiter - ,
supress absent element delimiter - "Never"
c) tr_recs has a reference to records and the max occurs is set to -1
d) Simple flow design:
MQInput Node
Message domain - 'MRM'
Message Type - 'tr_recs'
Message Format - 'TDS1'
Compute Node
SET OutputRoot.Properties.MessageFormat = 'XML';
MQOutput Node
This seems like a very simple issue to solve, but I'm not having a whole lot of luck with getting it to recognize the <CR><LF>. Not sure if its a message set design or something else. |
|
Back to top |
|
 |
shalabh1976 |
Posted: Thu Jul 06, 2006 8:29 pm Post subject: |
|
|
 Partisan
Joined: 18 Jul 2002 Posts: 381 Location: Gurgaon, India
|
I can show you one way to parse this:
Add tagged delimited format CSV:
1. Create your elements
2. Create you type(t1) with these elements
3. Create an element of above type(t1).
4. Create another type(t2) with the element created above(ec).
5. Create a message of type(t2)
On typ2 --> tab CSV
Data Element separation->All elements delimited
Delimiter -> <CR><LF>
On element under this type --> Repeat = Yes
CSV tab ->Repeating element delimiter = <CR><LF>
On typ1 --> tab CSV
Data Element separation->All elements delimited
Delimiter -> ,
Under the messages click on the element ec -->
Repeat = Yes,
Repeating element delimiter = <CR><LF>
There are other ways to do this by using the Group terminator also. _________________ Shalabh
IBM Cert. WMB V6.0
IBM Cert. MQ V5.3 App. Prog.
IBM Cert. DB2 9 DB Associate |
|
Back to top |
|
 |
kimbert |
Posted: Fri Jul 07, 2006 12:46 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
delimiter - X'0D0A' |
Try <CR><LF> instead. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|