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 » [RESOlVED]Extracting & assiging values from and to xml n

Post new topic  Reply to topic
 [RESOlVED]Extracting & assiging values from and to xml n « View previous topic :: View next topic » 
Author Message
jeevan
PostPosted: Wed Jan 24, 2007 9:37 pm    Post subject: [RESOlVED]Extracting & assiging values from and to xml n Reply with quote

Grand Master

Joined: 12 Nov 2005
Posts: 1432

I am having problem in extracting values from xml nodes ( edlement). My incoming XML message is as follows:

Quote:

<SUPPLIER>
<SUPPLIER_DETAIL>
<SUPPLIER_ID> S1 </SUPPLIER_ID>
<NAME>NorthPole Printers </NAME>
<CITY>Chicago </CITY>
</SUPPLIER_DETAIL>
<SUPPLIER_DETAIL>
<SUPPLIER_ID> S2 </SUPPLIER_ID>
<NAME>Oxford Press</NAME>
<CITY>Fairfield </CITY>
</SUPPLIER_DETAIL>
<SUPPLIER_DETAIL>
<SUPPLIER_ID> S3 </SUPPLIER_ID>
<NAME>Houghton </NAME>
<CITY>St. Paul </CITY>
</SUPPLIER_DETAIL>
</SUPPLIER>




I am trying to extract the value of the elements and write to database. I have the following statement for that:
Quote:

DECLARE rec REFERENCE TO InputBody.SUPPPLIER.SUPPLIER_DETAIL[I];


When I observed in visual debugger, I saw rec has whole XML. I wonder and for test purpose created other three variables: two of them ref variable and one character variable as follows:


DECLARE InputMsg REFERENCE TO InputBody.SUPPLIER;
DECLARE rec1 REFERENCE TO InputBody.SUPPPLIER.SUPPLIER_DETAIL;


DECLARE rec2 CHAR;
SET rec2= InputBody.SUPPPLIER.SUPPLIER_DETAIL[I].SUPPLIER_ID;
All three ref variables: rec, rec1 and rec3 have same value -> the whole XML and rec2 does not have anything. I do not get any syntax error.


Could someone please shed light on this issue. what mistake did I do?

thank you for your cooperation





INSERT INTO Database.SUPPLIER(SUPPLIER_ID,NAME,CITY) VALUES(rec.SUPPLIER_ID, rec.NAME, rec.CITY);


Last edited by jeevan on Thu Jan 25, 2007 4:57 am; edited 1 time in total
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Wed Jan 24, 2007 9:52 pm    Post subject: Re: Extracting and assiging values from and to xml elements Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi jeevan,
jeevan wrote:

Quote:

DECLARE rec REFERENCE TO InputBody.SUPPPLIER.SUPPLIER_DETAIL[I];
You SUPPPLIER has three Ps...

Regards.
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Thu Jan 25, 2007 2:07 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
what mistake did I do?
You did not check LASTMOVE after declaring each reference. If you had, you would have discovered the error which elvis correctly pointed out.
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 » [RESOlVED]Extracting & assiging values from and to xml n
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.