Author |
Message
|
Gama |
Posted: Mon Apr 18, 2005 9:19 am Post subject: CAST XML to Character |
|
|
 Centurion
Joined: 11 Jan 2005 Posts: 103 Location: Portugal
|
Hello,
Im new in WMQI, and i need to convert one XML message in one String of Character, and then include them in another xml message.
Here it is the message to convert:
<MSG>
<CLIE>306 < / CLIE>
<TABLE>T306LEPK < / TABLE>
<FIELD>LEDEP < / FIELD>
<QUEUE>WMQI_DESADV_IN < / QUEUE>
<LIB>MQSIBK < / LIB>
</MSG>
And the one that me necessÃto is the following:
SET OutputRoot.XML.DATA.TS = "message in", but the message need to be in text and not in XML.
It cannot be this way.
SET OutputRoot.XML.DATA.TS = InputRoot.XML;
Thank you for your support
Here it is the message to convert:
<MSG>
<CLIE>306 < / CLIE>
<TABLE>T306LEPK < / TABLE>
<FIELD>LEDEP < / FIELD>
<QUEUE>WMQI_DESADV_IN < / QUEUE>
<LIB>MQSIBK < / LIB>
</MSG>
And the one that me necessÃto is the following:
SET OutputRoot.XML.DATA.TS = "message in", but the message need to be in text and not in XML.
It cannot be this way.
SET OutputRoot.XML.DATA.TS = InputRoot.XML;
Thank you for your support |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Apr 18, 2005 10:14 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Do you want a string that is "<MSG><CLIE>306</CLIE><TABLE>" and etc?
Or do you want a string that does not have the XML Tags?
If you want the tags, then you want to use the ASBITSTREAM function.
If you do not want the tags, then you want to write a loop over the elements and use FIELDVALUE and the || concatenation operator.
Or you can model the data using TDS or CWF. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Gama |
Posted: Mon Apr 18, 2005 10:27 am Post subject: |
|
|
 Centurion
Joined: 11 Jan 2005 Posts: 103 Location: Portugal
|
jefflowrey wrote: |
Do you want a string that is "<MSG><CLIE>306</CLIE><TABLE>" and etc?
Or do you want a string that does not have the XML Tags?
If you want the tags, then you want to use the ASBITSTREAM function.
If you do not want the tags, then you want to write a loop over the elements and use FIELDVALUE and the || concatenation operator.
Or you can model the data using TDS or CWF. |
Is something like that:
all i need is that
<DATA>
<TS><MSG><CLIE>306</CLIE><TABLE></TS>
</DATA> |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Apr 18, 2005 10:37 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Yes, so use ASBITSTREAM on the Input XML and assign the results to the appropriate place in a new set of Output XML.
Make sure to call CopyMessageHeaders not CopyEntireMessage, so you can create all new Output XML. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Gama |
Posted: Mon Apr 18, 2005 10:43 am Post subject: |
|
|
 Centurion
Joined: 11 Jan 2005 Posts: 103 Location: Portugal
|
jefflowrey wrote: |
Yes, so use ASBITSTREAM on the Input XML and assign the results to the appropriate place in a new set of Output XML.
Make sure to call CopyMessageHeaders not CopyEntireMessage, so you can create all new Output XML. |
Bu using the BITSTREAM i give this result
<DATA>
<TS>X'3c4d53473e3c434c49453e3330363c2f434c49453e3c5441424c453e543330364c45504b3c2f5441424c453e3c4649454c443e4c454445503c2f4649454c443e3c51554555453e574d51495f4445534144565f494e3c2f51554555453e3c4c49423e4d515349424b3c2f4c49423e3c464c41473e5945533c2f464c41473e3c43504e593e444c533c2f43504e593e3c2f4d53473e'</TS>
</DATA>
This is not the message i need. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Apr 18, 2005 10:47 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Why would you use BITSTREAM?
I said ASBITSTREAM and I meant ASBITSTREAM.
Please show your ESQL. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Gama |
Posted: Mon Apr 18, 2005 10:51 am Post subject: |
|
|
 Centurion
Joined: 11 Jan 2005 Posts: 103 Location: Portugal
|
jefflowrey wrote: |
Why would you use BITSTREAM?
I said ASBITSTREAM and I meant ASBITSTREAM.
Please show your ESQL. |
Sorry.....
My excuses
Here is the code:
SET OutputRoot.XML.DATA.TS = CAST(asbitstream(InputRoot.XML) AS CHARACTER CCSID 1208);
and the output is:
<DATA>
<TS><MSG><CLIE>306</CLIE><TABLE>T306LEPK</TABLE><FIELD>LEDEP</FIELD><QUEUE>WMQI_DESADV_IN</QUEUE><LIB>MQSIBK</LIB><FLAG>YES</FLAG><CPNY>DLS</CPNY></MSG></TS>
</DATA> |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Apr 18, 2005 10:57 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
So you only need a set of the input, not all of it?
Then you can either... put in another compute node and change the message so that the Input XML to your current is all you need...
or use CREATE... DOMAIN to create a structure in Environment or LocalEnvironment that has the XML parser attached, and set the needed fields there, and then run ASBITSTREAM on that. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|