readInt and WXS [Re: CVS Update: xmlpull-api-v1/addons/java/wrapper/src/org/xmlpull/v1/wrapper/classic]

Aleksander Slominski <[email protected]> Tue, 01 Jul 2003 19:55:57 -0400
Newsgroups gmane.text.xml.xmlpull.devel
Message-ID <[email protected]>
Dennis Sosnoski wrote:

>You're going to have some problems with these. For one thing, 
>Integer.parseInt() will blow up with a leading '+' sign
>
i did not  know about this limitaiton - quite interesintg - i would 
think "+10" is legal integer - also interesting problem is what is  the 
most optimized way to read  and convert into string into integer (maybe 
read from char[] buffer directly?)

>and parseDouble()/parseFloat() will accept some values that WXS does not 
>allow. 
>
yes but they are (were?) common in some SOAP implementations - so 
following philosophy of being generous in what one accepts ... though 
maybe it should not be applied to WXS ..

>Finally, you need to trim leading and trailing whitespace on the 
>text values before parsing them for compatibility with WXS.
>
why is it required - i am only caring about parsed avlue (i.e. double) 
and lexical representation (toString()) should be fine?

>You might want to check my JiBX code for handling the WXS types:
>
>http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jibx/distrib/build/src/org/jibx/runtime/Utility.java
>  
>
>This has date/time handling as well as the numeric types. The methods 
>don't trim the whitespace, but that can easily be handled before calling 
>them.
>
thanks i copied parseInt() method. i have not even started to think how 
to deal with data/time from WXS. it seems that only reliable way is to 
have special java classes that mimic how gYear and friends are defined 
or do lot of checking each time int is passed and reated as year ...

thanks,

alek

-- 
"Mr. Pauli, we in the back are all agreed that your theory is crazy. 
What divides us is whether it is crazy enough to be true." Niels H. D. Bohr



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/2U_rlB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
[email protected]

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/