[jdom-interest] Attribute.getBooleanValue()

Zoltan Grose zgrose at pacbell.net
Wed Apr 25 17:41:33 PDT 2001

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!


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/1cd288a9/attachment.htm

More information about the jdom-interest mailing list