You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Tom Muldoon <to...@firstbest.com> on 2008/04/10 15:59:25 UTC

[jxpath 1.2] Why does InfoSetUtil.booleanValue method handle strings in the manner that it does???

Can anyone explain why the InfoSetUtil.booleanValue(Object object) method returns true when the object is a String if and only if it is a non-zero length string? Here's a code excerpt ...

        else if (object instanceof String) {
            return ((String) object).length() != 0;
        }
Is this a bug? Shouldn't it return true if and only if the string is equal to "true" (ignoring case, of course)?

Thanks in advance, Tom

PS. Is this message better suited for the dev list?

Re: [jxpath 1.2] Why does InfoSetUtil.booleanValue method handle strings in the manner that it does???

Posted by Matt Benson <gu...@yahoo.com>.
--- Tom Muldoon <to...@firstbest.com> wrote:

> Can anyone explain why the
> InfoSetUtil.booleanValue(Object object) method
> returns true when the object is a String if and only
> if it is a non-zero length string? Here's a code
> excerpt ...
> 
>         else if (object instanceof String) {
>             return ((String) object).length() != 0;
>         }
> Is this a bug? Shouldn't it return true if and only
> if the string is equal to "true" (ignoring case, of
> course)?
> 

See http://www.w3.org/TR/xpath#function-boolean .

> Thanks in advance, Tom
> 
> PS. Is this message better suited for the dev list?

Nope.  :)

-Matt

> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org