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 » How to handle zero to n child elements

Post new topic  Reply to topic
 How to handle zero to n child elements « View previous topic :: View next topic » 
Author Message
WBI_user
PostPosted: Sun Jul 20, 2003 4:28 pm    Post subject: How to handle zero to n child elements Reply with quote

Partisan

Joined: 07 Aug 2001
Posts: 386

I have an XML input message like this:
<msg>
<A1>111</A1>
<A2>222</A2>
<B>
<B1>333</B1>
<B2>444</B2>
:
</B>
<C1>555</C1>
<C2>666</C2>
</msg>
The B element can have zero to many children (0, B1...Bn) of different names.

If B contains no child, the message will be like:
<msg>
<A1>111</A1>
<A2>222</A2>
<B></B>
<C1>555</C1>
<C2>666</C2>
</msg>

Any idea what I have to do in the compute node of a simple flow (INPUT , COMPUTE, OUTPUT nodes) to ensure that there is no error.
Back to top
View user's profile Send private message
kirani
PostPosted: Sun Jul 20, 2003 9:23 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

I didn't get your question. What exactly you need to do in your message flow?
If you are reading your input message as Generic XML then any valid XML message will parse correctly. You don't have to do anything special in your message flow for this.
_________________
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
View user's profile Send private message Visit poster's website
WBI_user
PostPosted: Mon Jul 21, 2003 10:30 am    Post subject: Reply with quote

Partisan

Joined: 07 Aug 2001
Posts: 386

I should be more specific on my question
If the incoming message is :
<Inventory>
<part1>111</part1>
<part2>222</part2>
<part2_colour>
<red>10</red>
<white>20</white>
:
</part2_colour>
<part3>555</part3>
<part4>666</part4>
</Inventory>

This message says there are 222 part2s. 10 of them are red and 20 of them are white ......

I can have a number of part2 colours. Of course we know what are the colours, so there will a maximum number of "colour tags"

In my compute node, I have to act on each parts (say store the number of red and the number of white). For example, I'll do

set RED_C = InputRoot.XML.Inventory.part2_colour.red;
set WHITE_C = InputRoot.XML.Inventory.part2_colour.white;
:
do this for all colour that exist
:
INSERT INTO Database.INVENTORY(RED_NO,WHITE_NO...) VALUES(RED_C,WHITE_C....);

When there is no part2, the input message will look like:
<Inventory>
<part1>111</part1>
<part2></part2>
<part2_colour></part2_colour>
<part3>555</part3>
<part4>666</part4>
</Inventory>

MQSI will fail because InputRoot.XML.Inventory.part2_colour.red does not exist. This will fail for all clours.

What I am looking for is a way to make sure that the flow will not fail when the number of children changes.
Back to top
View user's profile Send private message
inder
PostPosted: Mon Jul 21, 2003 11:34 am    Post subject: Reply with quote

Apprentice

Joined: 24 Mar 2003
Posts: 49
Location: USA

AS kiran Said if you are using Generic XML (Not prediefined message set), your Message flow will never fail unless you have a database failure because of null values for the colour fields. (Say if they are Non nullable columns in your Database).

regards
Inder
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 » How to handle zero to n child elements
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.