commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Perez Jorge <>
Subject Re: [JXPath] Testing for null values.
Date Fri, 23 Jan 2004 11:07:47 GMT

WTF, I was wrong.  "boolean(propertyName/node())" doesn't work.  By now, 
I have developed a custom function test:isnull().  JXPath documentation 
says type conversion from null to primitive types is false/zero, so I 
believe this masks detection of a Boolean null property and maybe other 
cases for other types/classes.

That's all.

Adrian Perez Jorge wrote:

> Hi again,
>  Well, "boolean(propertyName/node())" seems to work; It will return 
> Boolean.TRUE if the path exists and it's not null, and will return 
> Boolean.FALSE if the path doesn't exist (lenient mode on) or the 
> property is null.
>   I need to do check that before this is evaluated:
>   "aBeanPath/booleanProperty = false()"
>   because if the path exists but booleanProperty is null, that 
> expression will be evaluated to true().
>  BTW if lenient mode is on and the path doesn't exist, both 
> "aBeanPath/booleanProperty = false()" and "aBeanPath/booleanProperty = 
> true()" will return false().  Shouldn't be this the right result when 
> the path exists but the property is null?
>  Thanks in advance.
> Adrian P.J.
> Adrian Perez Jorge wrote:
>> Hi all!
>>  What is the right way to test in a XPath expression if a bean 
>> property is null?
>>  "propertyName = false()" doesn't work because the property could be 
>> a Boolean.
>> Thanks in advance,
>> Adrian P.J.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message