|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
navigating throug nested structures |
« View previous topic :: View next topic » |
Author |
Message
|
m.schneider |
Posted: Thu Sep 20, 2007 8:59 am Post subject: navigating throug nested structures |
|
|
Centurion
Joined: 10 Apr 2007 Posts: 132 Location: Germany
|
Hi,
I have the following structure of a message.
<Msg>
<Party>
<SW95P>
<Qualifier> X </Qualifier>
<BIC> 123 <BIC>
</SW95P>
</Party>
<Party>
<SW95P>
<Qualifier> Y </Qualifier>
<BIC> 456 <BIC>
</SW95P>
</Party>
<Party>
<SW95P>
<Qualifier> Z </Qualifier>
<BIC> 789 <BIC>
</SW95P>
</Party>
</Msg>
There can be infinite occurences of party and I need to extract all
with the Qualifier = Z. How can I achieve this?
I have a working solution with a WHILE loop, but I'm curios if there is a smarter solution. I thougt perhaps with a SELECT or an FOR ALL loop, but I didn't find a good example, ... |
|
Back to top |
|
 |
kimbert |
Posted: Thu Sep 20, 2007 12:25 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
|
Back to top |
|
 |
m.schneider |
Posted: Thu Sep 20, 2007 11:50 pm Post subject: |
|
|
Centurion
Joined: 10 Apr 2007 Posts: 132 Location: Germany
|
Thanks for the reply, ... I do know the select statement, ... problem here ist that there is a multiple occurence of party and in each party is a field SW95P.
So if a select like this:
SELECT A.Qualifier
FROM InputRoot.XMLNSC.Msg.Party.SW95P[] AS A
WHERE A.QUALIFIER = 'Z'
The select only searches in the first occurence of party.
I need something like this:
SELECT A.SW95P.Qualifier
FROM InputRoot.XMLNSC.Msg.Party[] AS A
WHERE A.SW95P.QUALIFIER = 'Z'
But this isn't valid syntax, ... Is there any other chance? |
|
Back to top |
|
 |
mgk |
Posted: Fri Sep 21, 2007 1:38 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Actually your second SELECT is (almost) valid syntax. Certainly the idea here is correct. The only problem is that the case of the word qualifier is wrong, and you do not take the spaces into account around the value of the qualifier. A corrected version of you code that works with your input message (when the BIC tag is closed properly) is:
Code: |
SET OutputRoot.XMLNSC.Top.Answer[] =
SELECT A.SW95P.Qualifier
FROM InputRoot.XMLNSC.Msg.Party[] AS A
WHERE A.SW95P.Qualifier = ' Z ' ; |
The output of this is:
Code: |
<Top><Answer><Qualifier> Z </Qualifier></Answer></Top> |
_________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
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
|
|
|
|