|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Referencing to next element under same parent (XML) |
« View previous topic :: View next topic » |
Author |
Message
|
lung |
Posted: Wed Dec 11, 2002 2:02 am Post subject: Referencing to next element under same parent (XML) |
|
|
 Master
Joined: 27 Aug 2002 Posts: 291 Location: Malaysia
|
Hi all,
Assuming I have the following XML message...
<Msg>
<A>1</A>
<B>2</B>
<C>3</C>
</Msg>
Now assuming I do not know the field names for B and C, and only know A, is there anyway in which I can reference to B and C in ESQL?
Say, like... SET abc = InputBody.<<NextElementAfter>>A; ?? _________________ lung |
|
Back to top |
|
 |
kirani |
Posted: Wed Dec 11, 2002 8:29 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Hi Lung,
First define a reference to <A> tag and then use MOVE ... NEXTSIBLING command to move your reference pointer to point to the next sibling, in this case <B> tag.
For example,
Code: |
DECLARE ref REFERENCE to InputRoot.XML.Msg.A;
move ref NEXTSIBLING;
-- now ref is pointing to <B> tag
--SET abc = ref;
move ref NEXTSIBLING;
-- now ref is pointing to <C> tag.
--SET def = ref;
|
Pls refer to ESQL reference manual for more details. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
lillo |
Posted: Thu Dec 12, 2002 12:01 am Post subject: |
|
|
Master
Joined: 11 Sep 2001 Posts: 224
|
Hi,
use MOVE ... NEXTSIBLING as kirani said with a extra parameter.
Code: |
DECLARE ref REFERENCE to InputRoot.XML.Msg.A;
move ref NEXTSIBLING TYPE 0x01000000;
-- now ref is pointing to <B> tag
--SET abc = ref;
move ref NEXTSIBLING TYPE 0x01000000;
-- now ref is pointing to <C> tag.
--SET def = ref;
|
With this parameter you move to the next element. I had a situation where the "move nextsibling" statement moved to a CDATA, I though this could be the linefeed caracter.
Cheers, _________________ Lillo
IBM Certified Specialist - WebSphere MQ |
|
Back to top |
|
 |
lung |
Posted: Thu Dec 12, 2002 4:46 pm Post subject: |
|
|
 Master
Joined: 27 Aug 2002 Posts: 291 Location: Malaysia
|
Thanks all. I'll try out those methods  _________________ lung |
|
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
|
|
|
|