Author |
Message
|
LH33 |
Posted: Sat Aug 30, 2003 10:36 am Post subject: CDATA - Help! |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
HI! I have a message flow that transforms a tag from a decode value to it's full value. I am having a problem getting an & to display as an &. The value I am transforming is CUTNCLEAR. I need to display this as 'Cut & Clear'. When I do a
SET OutputRoot.XML.data =
CASE
WHEN 'CUTNCLEAR' THEN 'Cut & Clear'
the output is displayed as <Cut & Clear>
Can someone help me with how to display the & as an & and not have the &.
I have tried using the following CDatasection and all sorts of variations of it and cannot get it to work:
SET OutputRoot.XML.data.(XML.CDataSection) =
OutputRoot.XML.data; |
|
Back to top |
|
 |
kirani |
Posted: Sat Aug 30, 2003 7:06 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Try this,
Code: |
SET OutputRoot.XML.(XML.CDataSection)data = 'Cut & Clear' ;
|
_________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
LH33 |
Posted: Sun Aug 31, 2003 9:02 am Post subject: |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
Kiran,
I tried your suggestion and it still is not giving me the right output. Here is my input XML: The tag Filter index = 2 is the one I want to be "Cut & Clear'.
<SyncSpecDutyIn revision="1.0.0" environment="Test">
<DataArea>
<SpecDutyIn>
<Crew>
<AgencyCode>EOM</AgencyCode>
<CrewCode>EOM-E44910</CrewCode>
<CrewState>A</CrewState>
<CrewType/>
<CurrentJobNumber/>
<Filters>
<Filter index="1">CK</Filter>
<Filter index="2">EOM_CUTNCL</Filter>
<Filter index="3">30-02-03</Filter> </Filters>
<TagFlag>0</TagFlag>
<UserRouting>0</UserRouting>
<WorkCode>DEFAULT</WorkCode>
</Crew>
</SpecDutyIn>
</DataArea>
</SyncSpecDutyIn>
Here is my code:
DECLARE FIL2 CHAR;
SET FIL2 = THE ( SELECT ITEM R FROM
InputRoot.XML.SyncSpecDutyIn.DataArea.SpecDutyIn.Crew.Filters.Filter[] as R where
R.(XML.Attribute)index = '2');
SET OutputRoot.XML.SyncSpecDutyIn.DataArea.fil2 = FIL2;
IF FIL2 = 'EOM_CUTNCL' THEN
SET OutputRoot.XML.SyncSpecDutyIn.DataArea.SpecDutyIn.Crew.Filters.Filter[2].(XML.CDataSection)data =
'Cut & Clear' ;
SET OutputRoot.XML.SyncSpecDutyIn.DataArea.SpecDutyIn.Crew.Filters.Filter[2].(XML.Attribute)index=2;
Whe I run it, here is what is in the output tag: It looks like it may be picking up the third Filter index also. Do you have any suggestions? (Thanks for your help!))
<Filter index="2">
30-02-03
<![CDATA[Cut & Clear]]>
</Filter> |
|
Back to top |
|
 |
kirani |
Posted: Mon Sep 01, 2003 7:48 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
I tried following code on my machine with "Copy Complete Message" selected in Compute node.
Code: |
SET OutputRoot.XML.SyncSpecDutyIn.DataArea.SpecDutyIn.Crew.Filters.Filter[2] VALUE = NULL;
DECLARE FIL2 CHAR;
SET FIL2 = THE ( SELECT ITEM R FROM InputRoot.XML.SyncSpecDutyIn.DataArea.SpecDutyIn.Crew.Filters.Filter[] as R
where R.(XML.Attribute)index = '2');
SET OutputRoot.XML.SyncSpecDutyIn.DataArea.fil2 = FIL2;
IF FIL2 = 'EOM_CUTNCL' THEN
SET OutputRoot.XML.SyncSpecDutyIn.DataArea.SpecDutyIn.Crew.Filters.Filter[2].(XML.CDataSection)data = 'Cut & Clear' ;
END IF;
|
and it gives me following output,
Code: |
<SyncSpecDutyIn revision="1.0.0" environment="Test">
<DataArea>
<SpecDutyIn>
<Crew>
<AgencyCode>EOM</AgencyCode>
<CrewCode>EOM-E44910</CrewCode>
<CrewState>A</CrewState>
<CrewType/>
<CurrentJobNumber/>
<Filters>
<Filter index="1">CK</Filter>
<Filter index="2"><![CDATA[Cut & Clear]]></Filter>
<Filter index="3">30-02-03</Filter>
</Filters>
<TagFlag>0</TagFlag>
<UserRouting>0</UserRouting>
<WorkCode>DEFAULT</WorkCode>
</Crew>
</SpecDutyIn>
<fil2>EOM_CUTNCL</fil2>
</DataArea>
</SyncSpecDutyIn>
|
Is this is what you want? _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
LH33 |
Posted: Tue Sep 02, 2003 4:50 am Post subject: |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
Kiran,
Yes!! That works great! I have another question - I have another application that I need to send the same information to and would like to escape the & so that the recieving application does not have to remove the CDATA section.
Do you have any suggestions on how to code that?
Thanks!!! Have a good one! |
|
Back to top |
|
 |
kirani |
Posted: Tue Sep 02, 2003 8:39 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
For escaping the characters you don't have to do anything special in your ESQL code, XML parser would take care of this for you when writing out the message on a queue. For example,
SET OutputRoot.XML.COName = 'AT&T'; will get converted to AT&T automatically. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
LH33 |
Posted: Tue Sep 02, 2003 10:18 am Post subject: |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
Kiran,
Thanks!! It workd Grea!
Lisa |
|
Back to top |
|
 |
|