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 » Create FirstChild

Post new topic  Reply to topic
 Create FirstChild « View previous topic :: View next topic » 
Author Message
MB
PostPosted: Mon Feb 27, 2006 9:00 pm    Post subject: Create FirstChild Reply with quote

Acolyte

Joined: 25 Jun 2004
Posts: 52

Hi,

We are facing some issues while parsing Input xml.
Our code is:
CREATE FIRSTCHILD OF OutputRoot.XML PARSE(InputRoot.XML, InputRoot.MQMD.Encoding, InputRoot.MQMD.CodedCharSetId);

SET Environment.type = InputRoot.XML.abc.type;

IF Environment.type = 'z' THEN

DECLARE ref1 REFERENCE TO OutputRoot.XML.XML.xyz;
DETACH ref1;
ATTACH ref1 TO OutputRoot.XML AS FIRSTCHILD;
SET OutputRoot.XML.XML = NULL;



The Input xml message is <?xml version="1.0" encoding="UTF-8"?><abc><family>udas</family><type>z</type><id>1613</id><id>123</id><routingInfo><name>display_type</name><value>a</value></routingInfo><publishTime>2003-04-17 14:55:44.208 PDT</publishTime><hospitalID></hospitalID><messageData>&lt;!DOCTYPE z SYSTEM &quot;&gt;&lt;xyz&gt;&lt;id&gt;1613&lt;/id&gt;&lt;xyz1&gt;April UDA&lt;/xyz1&gt;&lt;module&gt;ITEM&lt;/module&gt;&lt;display_type&gt;LV&lt;/display_type&gt;&lt;data_type&gt;ALPHA&lt;/data_type&gt;&lt;data_length/&gt;&lt;single_value_ind&gt;N&lt;/single_value_ind&gt;&lt;/xyz&gt;</messageData></abc>

We can see error in Event Viewer as not well formed xml and Error detected whilst processing a message in node 'abc.MQOutput'.

Expected output is:
<xyz>
<id>1613</id>
<xyz1>April UDA</xyz1>
<module>ITEM</module>
<display_type>LV</display_type>
<data_type>ALPHA</data_type>
<data_length/>
<single_value_ind>N</single_value_ind>
</xyz>


Please let me know we are missing out on something.

Thanks
~mb.
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Mon Feb 27, 2006 10:25 pm    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi MB,

You are getting the error after/In the compute node or when you try to output the message through the output node ??

How is thedebug working ?

I notice that you are creating a ref1 to OutputRoot.XML.XML.xyz.....

Does the OutputRoot.XML.XML.xyz exist ?

Regards.
Back to top
View user's profile Send private message Send e-mail
dipankar
PostPosted: Tue Feb 28, 2006 12:50 am    Post subject: Reply with quote

Disciple

Joined: 03 Feb 2005
Posts: 171

Hi MB,
Code:
CREATE FIRSTCHILD OF OutputRoot.XML PARSE(InputRoot.XML, InputRoot.MQMD.Encoding, InputRoot.MQMD.CodedCharSetId);


I think parse clause expects bit stream, not field reference. Please see the syntax. you are getting exception from the above code. First correct the above one.

Besides this, one more issue remains that Elvis has already told you.
_________________
Regards
Back to top
View user's profile Send private message
MB
PostPosted: Tue Feb 28, 2006 1:40 am    Post subject: Reply with quote

Acolyte

Joined: 25 Jun 2004
Posts: 52

Thanks elvis, depankar for your replies.
I changed the CREATE FIRSTCHILD OF syntax and it seems to work.

As Elvis says I agree there is no reference to xyz. If we need to get a reference to that then how do we go about doing that. Kindly let me know

Thanks,
MB.
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Tue Feb 28, 2006 1:44 am    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi MB,

Quote:
If we need to get a reference to that then how do we go about doing that. Kindly let me know

If the Reference is from your input message then reference the InputRoot.XML instead of OutputRoot.XML....

Regards.


Last edited by elvis_gn on Tue Feb 28, 2006 1:47 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
dipankar
PostPosted: Tue Feb 28, 2006 1:45 am    Post subject: Reply with quote

Disciple

Joined: 03 Feb 2005
Posts: 171

Hi MB,
Quote:
I changed the CREATE FIRSTCHILD OF syntax and it seems to work.

How could you understand your code is working?

Could you post your modified code here again?
_________________
Regards
Back to top
View user's profile Send private message
MB
PostPosted: Tue Feb 28, 2006 2:18 am    Post subject: Reply with quote

Acolyte

Joined: 25 Jun 2004
Posts: 52

Hi All,

Thanks for the quick reply.

Here is my latest code:

CREATE PROCEDURE CopyEntireMessage()
BEGIN

DECLARE bodyBlob BLOB ASBITSTREAM(InputRoot.XML, InputRoot.MQMD.Encoding, InputRoot.MQMD.CodedCharSetId);
CREATE FIRSTCHILD OF OutputRoot.XML PARSE(bodyBlob, InputRoot.MQMD.Encoding, InputRoot.MQMD.CodedCharSetId);

DECLARE ref1 REFERENCE TO OutputRoot.XML.XML.abc.messageData;
DETACH ref1;
ATTACH ref1 TO OutputRoot.XML AS FIRSTCHILD;
SET OutputRoot.XML.XML = NULL;
END;


Input XML:

<?xml version="1.0" encoding="UTF-8"?>
<abc>
<family>udas</family>
<type>UDAHdrCre</type>
<id>1613</id>
<ribmessageID>........</ribmessageID>
<routingInfo>
<name>display_type</name>
<value>LV</value>
</routingInfo>
<publishTime>2003-04-17 14:55:44.208 PDT</publishTime>
<hospitalID></hospitalID>
<messageData>&lt;!DOCTYPE UDADesc SYSTEM &quot;http://www.retek.com/dtd/rib/UDADesc.dtd&quot;&gt;
&lt;xyz&gt;
&lt;uda_id&gt;1613&lt;/uda_id&gt;
&lt;uda_desc&gt;April UDA&lt;/uda_desc&gt;
&lt;module&gt;ITEM&lt;/module&gt;
&lt;display_type&gt;LV&lt;/display_type&gt;
&lt;data_type&gt;ALPHA&lt;/data_type&gt;
&lt;data_length/&gt;
&lt;single_value_ind&gt;N&lt;/single_value_ind&gt;
&lt;/xyz&gt;
</messageData>
</abc>

Expected output:

<xyz>
<uda_id>1613</uda_id>
<uda_desc>April UDA</uda_desc>
<module>ITEM</module>
<display_type>LV</display_type>
<data_type>ALPHA</data_type>
<data_length/>
<single_value_ind>N</single_value_ind>
</xyz>

Basically I am trying to get handle to a XML within the messageData tag of the outer XML, by extracting the inner XML.

Please let me know your valuable inputs on this.

Thanks,
~mb.
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Tue Feb 28, 2006 2:36 am    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi MB,

So where are you now, have you got it working ?

We cannot take you line by line on how to code, plz do try to play with the code, the level of satisfaction on learning by yourself is greater

Regards.
Back to top
View user's profile Send private message Send e-mail
dipankar
PostPosted: Tue Feb 28, 2006 2:40 am    Post subject: Reply with quote

Disciple

Joined: 03 Feb 2005
Posts: 171

Hi MB,
Elvis is absolutely correct.
However I am giving you some hints
First extract the contents of messageData as blob to a variable and then create the message body by create statement. See the create statement in ESQL guide
_________________
Regards
Back to top
View user's profile Send private message
MB
PostPosted: Tue Feb 28, 2006 5:20 am    Post subject: Reply with quote

Acolyte

Joined: 25 Jun 2004
Posts: 52

Hi,

I have already tried extracting the data from messageData. The code bombs at:
DECLARE bodyBlob BLOB ASBITSTREAM(InoutRoot.XML.abc.messageData, InputRoot.MQMD.Encoding, InputRoot.MQMD.CodedCharSetId);

The XML Parser error seen in debugger is "An error has been reported by the BIPXML4C component.".

Regards,
~mb.
Back to top
View user's profile Send private message
dipankar
PostPosted: Tue Feb 28, 2006 8:25 pm    Post subject: Reply with quote

Disciple

Joined: 03 Feb 2005
Posts: 171

ASBITSTREAM does not return the data, returns the data with field.
Here ASBITSTREAM will return
<messageData>data</messageData> as blob. But you need only data by which you want to create a XML message.

So you simply use CAST(InputRoot.XML.abc.messageData AS BLOB CCSID InputRoot.MQMD.CodedCharSetId)

After that create message body with domain and parse clause like CREATE LASTCHILD of OutputRoot Domain 'XML' PARSE (whatever)
_________________
Regards
Back to top
View user's profile Send private message
narendrach
PostPosted: Fri Mar 03, 2006 2:03 pm    Post subject: Reply with quote

Voyager

Joined: 29 Jun 2005
Posts: 78

try to use


DECLARE ref1 REFERENCE TO
OutputRoot.XML.XML.abc.messageData.(XML.AsisElementContent);
_________________
Narendra CH
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Create FirstChild
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.