ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » String to XML

Post new topic  Reply to topic
 String to XML « View previous topic :: View next topic » 
Author Message
mq one
PostPosted: Sun Aug 15, 2004 6:30 pm    Post subject: String to XML Reply with quote

Newbie

Joined: 14 Apr 2004
Posts: 6

I know we had a lot of topics with ASBITSTREAM and I expect that is what I have to use. My problem is, that I have a String with contains valid XML and I want to take this string and move it to a position, if possible in the Environment tree, as XML.
Sample my string looks like
<txt><grp>g1</grp><grp>g2</grp></txt>
my Environment
<Environment><Data><msg>m1</msg><msg>m2</msg></Environment>
and I want to achieve this <Environment><Data><msg>m1</msg><msg>m2</msg><txt><grp>g1</grp><grp>g2</grp></txt></Environment>

I can't use the RCD node and if possible the preferred option is one compute node. I am using WMQI v2.1 CSD5
Thanks for any help
Back to top
View user's profile Send private message
JT
PostPosted: Sun Aug 15, 2004 8:16 pm    Post subject: Reply with quote

Padawan

Joined: 27 Mar 2003
Posts: 1564
Location: Hartford, CT.

Take a look at the CREATE statement. Details can be found in the ESQL Reference manual.

For example:
Code:
CREATE LASTCHILD OF Environment.Data DOMAIN('XML') PARSE(ASBITSTREAM(MyXMLString),InputRoot.MQMD.Encoding,InputRoot.MQMD.CodedCharSetId)
Back to top
View user's profile Send private message
mq one
PostPosted: Mon Aug 16, 2004 8:55 pm    Post subject: Reply with quote

Newbie

Joined: 14 Apr 2004
Posts: 6

If I try this I get in the trace the following The result was 'X''' and the tree is empty.
Regards
Back to top
View user's profile Send private message
aks
PostPosted: Mon Aug 16, 2004 9:32 pm    Post subject: Reply with quote

Voyager

Joined: 19 Jul 2002
Posts: 84

I had a requirement some time ago to insert XML (that was stored as a string in a field on a mainframe COBOL application) in a designated position in an XML tree. The code was a follows (the tempChar variable has the XML as a string, and tempRef is just a temporary reference variable):


MOVE tempRef TO policyRefO."Insured";
DECLARE tempBlob BLOB CAST(tempChar AS BLOB CCSID 1208);
CREATE LASTCHILD OF tempRef.temp DOMAIN('XML') PARSE(tempBlob, MQENC_INTEGER_NORMAL, 1208);
SET tempRef = tempRef.temp.XML."Insured";
SET tempRef.temp = NULL;

This may work for you:
DECLARE tempBlob BLOB CAST('<txt><grp>g1</grp><grp>g2</grp></txt>' AS BLOB CCSID 1208);
CREATE LASTCHILD OF Environment.Data DOMAIN('XML') PARSE (tempBlob, MQENC_INTEGER_NORMAL, 1208);

Regards
Alan
Back to top
View user's profile Send private message
mq one
PostPosted: Tue Aug 17, 2004 1:53 am    Post subject: Reply with quote

Newbie

Joined: 14 Apr 2004
Posts: 6

The result is also an empty field!!
Back to top
View user's profile Send private message
aks
PostPosted: Tue Aug 17, 2004 4:12 pm    Post subject: Reply with quote

Voyager

Joined: 19 Jul 2002
Posts: 84

Strange - it seems to work for me. The code above produced the following (Enviornment) trace directly after the compute node:

(
(0x01000000):Data = (
(0x01000010):XML = (
(0x01000000):txt = (
(0x01000000):grp = (
(0x02000000): = 'g1'
)
(0x01000000):grp = (
(0x02000000): = 'g2'
)
)
)
)
)

I haven't started with your first piece of XML (ie appending the 2nd xml string), but adding the 2nd XML as a string to the Environment tree works OK. I also added the line
SET OutputRoot.XML = Environment.Data;
to the flow and saw the xml message on the output queue:
<XML>
<txt>
<grp>g1</grp>
<grp>g2</grp>
</txt>
</XML>

Alan
Back to top
View user's profile Send private message
mq one
PostPosted: Tue Aug 17, 2004 7:39 pm    Post subject: Reply with quote

Newbie

Joined: 14 Apr 2004
Posts: 6

Alan,
Thanks, it works nicely!! No idea, why I had those problems
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » String to XML
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.