[jdom-interest] Trimming attribute values before conversion

Elliotte Rusty Harold elharo at metalab.unc.edu
Sun May 4 12:00:51 PDT 2003


The W3C XML Schema Language recognizes strings with extra space as 
legal ints, integers, floats, etc. For example width="  75.2  " is a 
legal double. I suggest that in the Attribute class the various 
getDoubleValue, getFloatValue(), getBooleanValue() etc. methods trim 
white space from both ends of the string before attempting to convert 
them to the relevant types.
-- 
Elliotte Rusty Harold
elharo at metalab.unc.edu
Processing XML with Java (Addison-Wesley, 2002)
   http://www.cafeconleche.org/books/xmljava
   http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA



More information about the jdom-interest mailing list