|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
[RESOlVED]Extracting & assiging values from and to xml n |
« View previous topic :: View next topic » |
Author |
Message
|
jeevan |
Posted: Wed Jan 24, 2007 9:37 pm Post subject: [RESOlVED]Extracting & assiging values from and to xml n |
|
|
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 |
|
 |
elvis_gn |
Posted: Wed Jan 24, 2007 9:52 pm Post subject: Re: Extracting and assiging values from and to xml elements |
|
|
 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 |
|
 |
kimbert |
Posted: Thu Jan 25, 2007 2:07 am Post subject: |
|
|
 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 |
|
 |
|
|
 |
|
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
|
|
|
|