|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Help using eSQL with XML message |
« View previous topic :: View next topic » |
Author |
Message
|
minra |
Posted: Fri Jun 28, 2002 3:23 am Post subject: Help using eSQL with XML message |
|
|
Newbie
Joined: 28 Jun 2002 Posts: 2
|
Hello,
I'm new in using WMQI and eSQL.
Does someone help me to do such transformation in WMQI V2.1. ?
Using the XML parser and eSQL, I would like to transform this input:
<MsgIn>
<Data>JohnDoe</Data>
<Data>GarrySmith</Data>
<Data>ErwinTate</Data>
</MsgIn>
in a this sort of output
<MsgOut>
<John>Doe</John>
<Garr>ySmith</Garr>
<Erwi>nTate</Erwi>
</MsgOut>
In fact, the name of the new tags generated is based on the four first characters of the input data.
Thanks in advance... |
|
Back to top |
|
 |
CodeCraft |
Posted: Fri Jun 28, 2002 5:30 am Post subject: |
|
|
Disciple
Joined: 05 Sep 2001 Posts: 195
|
Typically, the source of the tag name is literally specified in ESQL, it cannot be a variable. However, if you check out the ESQL evaluate function, you should be able to work out how to achieve what you want.
declare tagname character;
declare tagvalue character;
set tagname = substring(InputRoot.XML.Data[1] from 1 for 4);
set tagvalue = substring(InputRoot.XML.Data[1] from 5);
eval('Set OutputRoot.XML.'||tagname||' = tagvalue');
I haven't actually tried this, you may need to tweak it.
Eval should reconstruct the statements as (eg):
Set OutputRoot.XML.John = tagvalue;
and then execute it. |
|
Back to top |
|
 |
minra |
Posted: Fri Jun 28, 2002 8:00 am Post subject: |
|
|
Newbie
Joined: 28 Jun 2002 Posts: 2
|
I try the eSQL sentence you propose. To my great surprise, the result is a failure without nothing at all in the event viewer.
If I write :
eval('Set OutputRoot.XML.Z'||tagname||' = tagvalue');
It works, i.e WMQI generates from
<XML>
<Data>JohnDoe</Data>
</XML>
an output like:
<XML>
<ZJohn>Doe</ZJohn>
</XML>
But without a Z before the '||tagname||' or any sort of character (A, B, C...), it goes in failure without no more reason.
CSD02 has been applied on WMQI 2.1 on W2K + SP2.
Does anybody have an idea about such matter ? |
|
Back to top |
|
 |
CodeCraft |
Posted: Fri Jun 28, 2002 8:17 am Post subject: |
|
|
Disciple
Joined: 05 Sep 2001 Posts: 195
|
Obviously, there must be one overall parent in the document. are the tags: <XML></XML> actually part of your message? If not, you would have to have a "top level container". |
|
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
|
|
|
|