|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Input XML goes into Output XML as escaped stream |
« View previous topic :: View next topic » |
Author |
Message
|
vedbhat |
Posted: Thu Sep 18, 2003 7:59 pm Post subject: Input XML goes into Output XML as escaped stream |
|
|
 Disciple
Joined: 19 Mar 2002 Posts: 186 Location: Singapore
|
Hi All,
I have an XML, which is coming as Input to the message flow. I would like to create output as XML in which the entire Input XML need to go as the value for one of tag. The entire Input XML to be in replace the escape character before setting the data in the tag.
Has anybody tried this.
The Problem that I face is, I am able to escape special character within the XML using (XML.Contents) options if I hardcode the value instead of InputBody but when I assign the InputBody to the Output XML tag, it comes as NULL tag.
Eg:- Set OutputRoot.XML.ABC.XYZ(XML.Content) = InputBody;
Appreciate any help and Thanks in Advance. |
|
Back to top |
|
 |
Craig B |
Posted: Fri Sep 19, 2003 10:22 am Post subject: |
|
|
Partisan
Joined: 18 Jun 2003 Posts: 316 Location: UK
|
Hi,
In your ESQL, you have the following :
Code: |
Set OutputRoot.XML.ABC.XYZ(XML.Content) = InputBody;
|
In this you have put the field type (in the round brackets), after the field name you have specified. The fieldtype should appear before this to make it syntactically correct, such as :
Code: |
Set OutputRoot.XML.ABC.(XML.Content)XYZ = InputBody;
|
However I believe this will still give the same problem. When using XML.Content, then you are set the value for a specific tag. Generally an XML tag can have many children, one of which is the value of the tag itself. When using XML.Content you are manipulating the value itself which cannot have any children. Usually when you reference the InputBody then you dealing with all of the child field/elements that it represents. However, since you have specified XML.content to manipulate the value, then you cannot reference a whole subtree with many fields. The ESQL processing knows that you can only take one specific value, and so gives you the specific value of the field represent by InputBody. This would have been the same as specifying FIELDVALUE(InputBody), and I would imagine that in your input message, the root element does not have a value of its own. So in affect this is the zero length string, and so you have done the equivalent of et OutputRoot.XML.ABC.(XML.Content)XYZ = ''; and this is why you get the empty tags.
From your description I am not sure what you are trying to accomplish in your scenario. Could you give an example of an input message you are sending in, and what you want in the Output message?
If you had issued your ESQL statement without the XML.Content, then this would have copied the Input XML fields to the folder you have named in the output XML message. These would get written as children of this field in the output message, but when you say you want the input message in the output message, then Im not sure whether you want this to parsed as XML or not? If you want this XML to be shielded from the XML parse on the receiving side, such that you get this all into one field, then you would need to enclose it in a CDATA section to shield it from the parser.
Could you please clarify with an example. _________________ Regards
Craig |
|
Back to top |
|
 |
jefflowrey |
Posted: Sun Sep 21, 2003 8:05 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I think he wants the ASBITSTREAM function. |
|
Back to top |
|
 |
vedbhat |
Posted: Sun Sep 21, 2003 3:20 pm Post subject: |
|
|
 Disciple
Joined: 19 Mar 2002 Posts: 186 Location: Singapore
|
Below is the sample of what I want to accomplish,
Input XML
-----------
<A>
<B>Test1</B>
<C>Test2</C>
<D>Test3</D>
</A>
Functionality
--------------
Input XML needs to be parsed and escape special character like,
> - >
< - <
& - &
" - "
' - '
Required output XML
-----------------------
<X>
<Y>XYZ></Y> <Z><A><B>Test1</B><C>Test2</C><D>Test3</D></A></Z>
</X>
I hope this will give a clear picture. _________________ IBM Certified Solutions Expert - MQSeries Workflow
IBM Certified Specialist - MQSeries |
|
Back to top |
|
 |
jefflowrey |
Posted: Sun Sep 21, 2003 4:26 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
vedbhat wrote: |
I hope this will give a clear picture. |
Yes.
You want the ASBITSTREAM function. |
|
Back to top |
|
 |
vedbhat |
Posted: Sun Sep 21, 2003 6:07 pm Post subject: |
|
|
 Disciple
Joined: 19 Mar 2002 Posts: 186 Location: Singapore
|
Hi Jeff,
If I use BISTREAM function then data is converted to HEX. How do I convert the data from HEX to ASCII string.
Regards
Ved _________________ IBM Certified Solutions Expert - MQSeries Workflow
IBM Certified Specialist - MQSeries |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Sep 22, 2003 3:55 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
vedbhat wrote: |
Hi Jeff,
If I use BISTREAM function then data is converted to HEX. How do I convert the data from HEX to ASCII string.
|
Use the function ASBITSTREAM, not the function BITSTREAM. And give a CCSID parameter to the ASBITSTREAM function.
There are several other discussions in this forum about using the ASBITSTREAM function to do what you're looking to do. Try using the search function for 'ASBITSTREAM'. |
|
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
|
|
|
|