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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
