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 » Testing a tag existence with ESQL with XMLNSC

Post new topic  Reply to topic
 Testing a tag existence with ESQL with XMLNSC « View previous topic :: View next topic » 
Author Message
[EG]Slayer
PostPosted: Wed Apr 13, 2011 7:04 am    Post subject: Testing a tag existence with ESQL with XMLNSC Reply with quote

Novice

Joined: 01 Aug 2008
Posts: 16

Hi,

I've something strange with MessageBroker V7.0.0.2 testing a field existence in an xml message.

<Flow>
<Data>
<Customer>Smith</Customer>
</Data>
</Flow>

With Message Broker V6 using XML parser:
IF(InputRoot.XML.Flow.Data.Customer IS NULL)
THEN
RETURN(TRUE);
ELSE
RETURN(FALSE);
END IF;
--> When testing the result is FALSE

With Message Broker V7.0.0.2 using XMLNSC parser:
IF(InputRoot.XMLNSC.Flow.Data.Customer IS NULL)
THEN
RETURN(TRUE);
ELSE
RETURN(FALSE);
END IF;
--> When testing the result is TRUE

If I use CARDINALITY instead of IS NULL, it works but what's the problem with IS NULL??

Thanks for your help
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Apr 13, 2011 7:07 am    Post subject: Re: Testing a tag existence with ESQL with XMLNSC Reply with quote

Grand High Poobah

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

[EG]Slayer wrote:
If I use CARDINALITY instead of IS NULL, it works but what's the problem with IS NULL??


If you're used either code sample with the example XML given, I'd have expected neither to test true for NULL as the value appears to be Smith.



In an actual example is the Customer tag actually NULL or is it empty? I suspect the XMLNSC domain is far more rigerous on such matters than the XML domain (which you shouldn't be using in v6) was and is.

(P.S. - next time you post a thread in the wrong forum, just add to it asking for it to be moved. No need to edit & repost. )
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Wed Apr 13, 2011 7:28 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

And before any IBM'ers get in...

You should not be using the XML Parser for any new development. It has been deprecated for at least two releases now.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
[EG]Slayer
PostPosted: Wed Apr 13, 2011 7:49 am    Post subject: Reply with quote

Novice

Joined: 01 Aug 2008
Posts: 16

Yes I know,

That's old flows still existing (developped with message broker 2.1), we want to update them with the xmlnsc parser


For Vitor, here is just a example to explain my problem
It's not the same for us if the tag <Customer> is empty or if there is no tag <Customer> ...
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Apr 13, 2011 8:05 am    Post subject: Reply with quote

Grand High Poobah

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

[EG]Slayer wrote:
For Vitor, here is just a example to explain my problem
It's not the same for us if the tag <Customer> is empty or if there is no tag <Customer> ...


I suspected that. I think you'll find the W3C XML specification considers those 2 cases to be different (even if you don't) & the XMLNSC parser respects that.

You'll need code to get round this. One less computationally expensive option that CARDINALITY is LENGTH(FIELDVALUE(Customer)) = 0.

Or for the pedantic LENGTH(TRIM BOTH(FIELDVALUE(Customer))) = 0.

Other possibly better solutions undoubtably exist and may fit your needs in a way these examples (which are offered without warranty & have not even been syntax checked) don't.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Apr 13, 2011 11:11 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
old flows still existing (developped with message broker 2.1), we want to update them with the xmlnsc parser
FYI, the old XML parser will always be available, and will continue to be supported. When we say that it is 'deprecated' we mean that IBM does not recommend that you use it in new message flows.

re: the question about IS NULL, XMLNSC does behave slightly differently from XML and XMLNS. This topic does warn about that: http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/topic/com.ibm.etools.mft.doc/ac67210_.htm

You can learn about how XMLNSC treats null values here: http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/topic/com.ibm.etools.mft.doc/ad67010_.htm
...but if you are in the middle of a migration exercise, I expect you have read both of those topics already
Back to top
View user's profile Send private message
rekarm01
PostPosted: Wed Apr 13, 2011 5:02 pm    Post subject: Re: Testing a tag existence with ESQL with XMLNSC Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

[EG]Slayer wrote:
what's the problem with IS NULL??

The problem is that "IS NULL?" and "EXISTS?" are two different questions, with two possibly different answers.

Elements do not require non-NULL values in order to exist.

For example, XMLNSC.Folder elements don't have any values at all, and nillable XMLNSC.Field elements can have NULL values.

[EG]Slayer wrote:
With Message Broker V7.0.0.2 using XMLNSC parser:
...
--> When testing the result is TRUE

Vitor wrote:
If you've used either code sample with the example XML given, I'd have expected neither to test true for NULL as the value appears to be 'Smith'.

Vitor is correct. 'Smith' IS almost always NOT NULL, regardless of parser.

For other suggestions, check here.
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 » Testing a tag existence with ESQL with XMLNSC
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.