|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Converting XML tag values to tab delimited BLOB |
« View previous topic :: View next topic » |
Author |
Message
|
tdwells |
Posted: Mon Mar 24, 2003 1:14 pm Post subject: Converting XML tag values to tab delimited BLOB |
|
|
Apprentice
Joined: 30 Oct 2002 Posts: 42
|
Can someone please point me in the right direction. I want to take an incoming XML document and parse the values of certain XML tags into a tab delimited BLOB output node. If possible, I would like to do this using a compute node without any MRM's.
Incoming XML:
<Message>
<PrefixInfo>
<Flag1>True</Flag1>
<Flag2>123</Flag2>
<PrefixInfo>
<Message>
Expected Output:
True<tab>123<tab>
Thanks _________________ IBM Certified Specialist - MQSeries |
|
Back to top |
|
 |
mapa |
Posted: Tue Mar 25, 2003 5:17 am Post subject: XML -> tab BLOB |
|
|
 Master
Joined: 09 Aug 2001 Posts: 257 Location: Malmö, Sweden
|
Hi,
The way I'd do it is to use the ability that you now can cast between CHAR and BLOB in a "normal" way, (not going through the hex format).
This code produces what you want, I quickly tested it, and could be written to be more generic perhaps.
Code: |
-- Enter SQL below this line. SQL above this line might be regenerated, causing any modifications to be lost.
-- copy MQMD
SET OutputRoot.MQMD = InputRoot.MQMD;
-- set new Properties
SET OutputRoot.Properties.MessageDomain = 'BLOB';
SET OutputRoot.Properties.MessageSet = '';
SET OutputRoot.Properties.MessageType = '';
SET OutputRoot.Properties.MessageFormat = '';
--DECLARE RFH2_BLOB BLOB;
DECLARE TempChar CHAR;
DECLARE TempBlob BLOB;
DECLARE TAB BLOB;
-- Horizontal tab is hex 09
SET TAB = CAST ('09' AS BLOB);
SET TempChar = InputRoot.XML."Message"."PrefixInfo"."Flag1";
SET TempBlob = CAST(TempChar AS BLOB CCSID InputRoot.MQMD."CodedCharSetId") || TAB;
SET TempBlob = TempBlob || CAST(InputRoot.XML."Message"."PrefixInfo"."Flag2" AS BLOB CCSID InputRoot.MQMD."CodedCharSetId") || TAB;
Set OutputRoot.BLOB.BLOB = TempBlob;
|
Best regards Mapa |
|
Back to top |
|
 |
tdwells |
Posted: Tue Mar 25, 2003 12:40 pm Post subject: |
|
|
Apprentice
Joined: 30 Oct 2002 Posts: 42
|
Mapa,
Thanks for your reply. With some additional modifications, it worked great. Thanks.
Regards,
Troy _________________ IBM Certified Specialist - MQSeries |
|
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
|
|
|
|