|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
checking for unknown elements |
« View previous topic :: View next topic » |
Author |
Message
|
ajomillar |
Posted: Wed Dec 17, 2003 1:35 pm Post subject: checking for unknown elements |
|
|
 Centurion
Joined: 22 Aug 2003 Posts: 121 Location: Milwaukee, WI
|
How do you code an IF-THEN for the following situation: An input XML message is missing an element. The Compute node will check to see if this element is missing then perform an action as a result. For example...
Code: |
IF "InputBody"."ISE_RESULT"."IseResult".Foo = UNKNOWN THEN
RETURN FALSE;
END IF;
|
In this case, the intent of this construct is to jump out of node processing without propagating a message. I was scanning the ESQL Reference for examples but nothing helpful. Any thoughts??? |
|
Back to top |
|
 |
EddieA |
Posted: Wed Dec 17, 2003 4:09 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Do you mean missing the complete element, or the element is present, but is empty.
For the missing element, you could probably check the FIELDNAME:
Code: |
IF FIELDNAME("InputBody"."ISE_RESULT"."IseResult".Foo) <> 'Foo' THEN
RETURN FALSE
ENDIF |
For an element that is present, but empty:
Code: |
IF "InputBody"."ISE_RESULT"."IseResult".Foo = '' (or maybe IS NULL) THEN
RETURN FALSE
ENDIF |
And yes, the RETURN FALSE will end the processing at that point, and you have just "lost" your input message. Was that your intent. Perhaps you should route it to an "Error Queue" for further investigation.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
ajomillar |
Posted: Thu Dec 18, 2003 7:37 am Post subject: |
|
|
 Centurion
Joined: 22 Aug 2003 Posts: 121 Location: Milwaukee, WI
|
I meant the complete element was missing. Also, I intend to stop node processing by using a RETURN FALSE. The compute node I'm constructing will create or not create messages based on certain conditions. One condition is to check for the existence of the "foo" element. If it doesn't exist, then processing. In a prior node, the message is formed based on a database lookup. If there is no value (null) in a table's field, then the element is not added to the message structure. Probably not a good practice. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Dec 18, 2003 7:51 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
AJM wrote: |
I meant the complete element was missing. Also, I intend to stop node processing by using a RETURN FALSE. The compute node I'm constructing will create or not create messages based on certain conditions. One condition is to check for the existence of the "foo" element. If it doesn't exist, then processing. In a prior node, the message is formed based on a database lookup. If there is no value (null) in a table's field, then the element is not added to the message structure. Probably not a good practice. |
You can check for a missing element by seeing if it's NULL. Of course, this will also return true if the element exists but is empty.
Or you could loop through the FIELDNAMES of the children of the parent element. _________________ I am *not* the model of the modern major general. |
|
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
|
|
|
|