[jdom-interest] Attribute.getBooleanValue()

philip.nelson at omniresources.com philip.nelson at omniresources.com
Wed Apr 25 18:42:48 PDT 2001


JDOM ignores 0 & 1 now in the same way as "true" and "false".
getBooleanValue() was removed a *long* time ago.  You should update your
version of JDOM  :-)

-----Original Message-----
From: Zoltan Grose [mailto:zgrose at pacbell.net]
Sent: Wednesday, April 25, 2001 7:42 PM
To: jdom-interest at jdom.org
Subject: [jdom-interest] Attribute.getBooleanValue()


Hi. JDOM newbie here. :) 
 
I'm using JDOM in a servlet project and I was about to change all my
True/False type attributes in the XML to be 0 / 1 when I decided to peek at
the JDOM source to see just what kind of values were considered boolean. To
my surprise, 0 and 1 wasn't on the list. Was this an intention omission? It
seems to be a fairly common representation. I did a quick search through the
archives and didn't see anything on the topic.
 
Loving JDOM so far!
 
-zoltan
 
For convenience I've copied the source (beta6) below:
 
    public boolean getBooleanValue() throws DataConversionException {
        if ((value.equalsIgnoreCase("true")) ||
            (value.equalsIgnoreCase("on")) ||
            (value.equalsIgnoreCase("yes"))) {
            return true;
        } else if ((value.equalsIgnoreCase("false")) ||
                   (value.equalsIgnoreCase("off")) ||
                   (value.equalsIgnoreCase("no"))) {
            return false;
        } else {
            throw new DataConversionException(name, "boolean");
        }
    }
 
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20010425/f98dfb96/attachment.htm


More information about the jdom-interest mailing list