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 » Accessing null values in XMLNSC domain

Post new topic  Reply to topic
 Accessing null values in XMLNSC domain « View previous topic :: View next topic » 
Author Message
siri2083
PostPosted: Sat May 23, 2009 8:13 pm    Post subject: Accessing null values in XMLNSC domain Reply with quote

Apprentice

Joined: 16 Apr 2009
Posts: 39

Hi,

I am trying to check an element is holding null value or not in XMLNSC domain.

Input message looks like:
<EMP>
<ID>123</ID>
<Name/>
</EMP>

Below is the code:

Set Enviroment.Variables. InputMessage = InputRoot.XMLNSC.EMP;
If Enviroment.Variables. InputMessage.EMP.Name IS NULL THEN

throw user exception;

else do other process;


Now the problem is if name is null, it is working fine. when name is have some sub elements, ex:
<EMP>
<ID>123</ID>
<Name>
<FN>slk</FN>
<LN>rth</LN>
</Name>
</EMP>
in the above case, Name is not null. But still it is saying that name is null.
Please suggest.
Back to top
View user's profile Send private message
Vitor
PostPosted: Sun May 24, 2009 1:18 am    Post subject: Re: Accessing null values in XMLNSC domain Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

siri2083 wrote:
Please suggest.


You could try something like:

Code:

DECLARE aRef REFERENCE TO InputRoot.XMLNSC.EMP.Name;
MOVE aRef FIRSTCHILD;
IF LASTMOVE(aRef) THEN
...
ELSE
....
END IF;


Only a suggestion, not tested in any way, coded entirely from memory, other solutions are undoubtably possible, no warrenty express or implied accepted, etc, etc.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Sun May 24, 2009 4:38 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

So you want to find out if the Name element, regardless of what value it has, has any children?
Back to top
View user's profile Send private message
MQEnthu
PostPosted: Sun May 24, 2009 9:11 pm    Post subject: Reply with quote

Partisan

Joined: 06 Oct 2008
Posts: 329
Location: India

You want to find out if the Name has value or not ?Or check if it has children FN and LN .. If this is the case, then Try the code snippet posted below in Vitors reply...

Vitor wrote:
You could try something like:
Code:
DECLARE aRef REFERENCE TO InputRoot.XMLNSC.EMP.Name;
MOVE aRef FIRSTCHILD;
IF LASTMOVE(aRef) THEN
...
ELSE
....
END IF;

_________________
-----------------------------------------------
It is good to remember the past,
but don't let past capture your future
Back to top
View user's profile Send private message
siri2083
PostPosted: Sun May 24, 2009 9:12 pm    Post subject: Reply with quote

Apprentice

Joined: 16 Apr 2009
Posts: 39

Hi mqjeff,

Yes, i want to check Name element is null or not regardless of its child elements and its value.

Back to top
View user's profile Send private message
MQEnthu
PostPosted: Sun May 24, 2009 9:17 pm    Post subject: Reply with quote

Partisan

Joined: 06 Oct 2008
Posts: 329
Location: India

siri2083 wrote:
Yes, i want to check Name element is null or not regardless of its child elements and its value.


Will there be any chances you will get the element name populated, e.g: <Name>xyz</Name>.. or always it will have FN and LN as its child elements when ever name is filled..

Check the schema, how does it look like...
_________________
-----------------------------------------------
It is good to remember the past,
but don't let past capture your future
Back to top
View user's profile Send private message
siri2083
PostPosted: Sun May 24, 2009 9:28 pm    Post subject: Reply with quote

Apprentice

Joined: 16 Apr 2009
Posts: 39

Hi MQEnthu,

As Name element is of complex type. it will have child elements .

please suggest.
Back to top
View user's profile Send private message
MQEnthu
PostPosted: Sun May 24, 2009 9:44 pm    Post subject: Reply with quote

Partisan

Joined: 06 Oct 2008
Posts: 329
Location: India

siri2083 wrote:
As Name element is of complex type. it will have child elements .

please suggest.


Try this:

Vitor wrote:
Code:
DECLARE aRef REFERENCE TO InputRoot.XMLNSC.EMP.Name;
MOVE aRef FIRSTCHILD;
IF LASTMOVE(aRef) THEN
...
ELSE
....
END IF;


Try and let us know if you face any problem
_________________
-----------------------------------------------
It is good to remember the past,
but don't let past capture your future
Back to top
View user's profile Send private message
siri2083
PostPosted: Sun May 24, 2009 11:11 pm    Post subject: Reply with quote

Apprentice

Joined: 16 Apr 2009
Posts: 39

Hi All,

Its working fine with above code.

Thank you.

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 » Accessing null values in XMLNSC domain
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.