[jdom-interest] getBooleanValue() in Attribute

Elliotte Rusty Harold elharo at metalab.unc.edu
Tue May 14 08:52:27 PDT 2002


Currently, getBooleanValue recognizes "true", "on", and "yes" as true 
and "false", "off", and "no" as false.

I suspect we should follow the W3C XML Schema definitionn of boolean; 
i.e. "true" and "1" are true; "false" and "0" are false. All other 
values throw an exception.

A weaker version would keep "on/off" and "yes/no" but add 0 and 1.

Finally, I suggest we trim white space before makiing the conversion; 
e.g. "   true    " would be true and "  false  " would be false. 
Currently these cases throw an exception. This is also in keeping with 
the behavior of the W3C XML Schema Language.

-- 
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+ 
|           The XML Bible, 2nd Edition (IDG Books, 2001)             |
|             http://www.cafeconleche.org/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:   http://www.cafeaulait.org/     | 
|  Read Cafe con Leche for XML News:  http://www.cafeconleche.org/   |
+----------------------------------+---------------------------------+






More information about the jdom-interest mailing list