RE: XML Schema types to Java
"Naresh Bhatia" <[email protected]> Sun, 9 Mar 2003 18:47:55 -0500
| Newsgroups | gmane.text.xml.xmlpull.devel |
|---|---|
| Message-ID | <[email protected]> |
Dennis, Great work! I see that you have put a lot of effort into this. Naresh -----Original Message----- From: Dennis Sosnoski [mailto:[email protected]] Sent: Sunday, March 09, 2003 5:42 PM To: [email protected] Subject: Re: [xmlpull-dev] XML Schema types to Java Aleksander Slominski wrote: >Naresh Bhatia wrote: > >>Anyone know of a good library to convert XML Schema types to Java and >>back. Specifically I am trying to convert xsd:dateTime to >>java.util.Date and back. >> >> >i would check castor.exolab.org as it must have something like that >implemented and it is actively developed (so well tested) and has good >open source license (so you can use it in your apps and not worry about >viral licensing ...) otherwise check also JaxME and other XML >databinding libraries as there is many of them currently - one list of >available packages is at the end of Dennis Sosnoski article: >http://www-106.ibm.com/developerworks/library/x-databdopt2/#resources > I don't know how well Castor's code has really been tested - I tried a few experiments when I was doing my performance tests and found it rejected int values with a leading plus sign ("+3"), which are perfectly legal in Schema. It looked like they were just using the standard Java library code for at least this conversion. There are quite a few subtle difference between the Java library implementations and the Schema standard. This is especially true for the date/time handling, where Schema calls for a proleptic Gregorian calendar (one that applies back before the actual origin of the calendar) while Java implements the Gregorian calendar with a discontinuity. This abviously won't matter to most people - dates from 1600 and earlier aren't exactly common in modern business documents! - but it's obviously best to have a library implement the proper handling. I've got a set of conversions implemented in my JiBX code that I've been testing in preparation for the upcoming beta. The code is now in CVS at http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jibx/distrib/build/src/or g/jibx/runtime/Utility.java, with the JUnit tests at http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jibx/distrib/build/src/te st/jibx/runtime/UtilityTest.java Besides being tested vs the Schema specification (modulo any misinterpretations by me), both the int parsing and the date/time conversions in both directions are considerably faster than the Java versions. - Dennis Yahoo! Groups Sponsor <http://rd.yahoo.com/M=247865.3003379.4374531.2848452/D=egroupweb/S=1706 030390:HM/A=1482387/R=0/*http://ads.x10.com/?bHlhaG9vaG0xLmRhd=104724992 0%3eM=247865.3003379.4374531.2848452/D=egroupweb/S=1706030390:HM/A=14823 87/R=1=1047249920%3eM=247865.3003379.4374531.2848452/D=egroupweb/S=17060 30390:HM/A=1482387/R=2> <http://us.adserver.yahoo.com/l?M=247865.3003379.4374531.2848452/D=egrou pmail/S=:HM/A=1482387/rand=717794500> To unsubscribe from this group, send an email to: [email protected] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> .