I created a Bug in Jira: http://jira.codehaus.org/browse/CASTOR-1945
I've submitted a Junit test case, and a patch to apply to fix the issue. -----Original Message----- From: Daniels, Doug Sent: Thursday, April 12, 2007 4:06 PM To: '[EMAIL PROTECTED]' Subject: RFR: XMLInstance2Schema error skipping DatTime conversion I tried using the XMLInstance2Schema to convert an XML file to a schema file for castor to use, but I got the following exception: java.lang.IllegalArgumentException: hour 42 must be strictly less than 24 at org.exolab.castor.types.DateTimeBase.setHour(DateTimeBase.java:311) at org.exolab.castor.types.DateTimeBase.parseTime(DateTimeBase.java:1190) at org.exolab.castor.types.Time.parseTimeInternal(Time.java:238) at org.exolab.castor.types.Time.parseTime(Time.java:225) at org.exolab.castor.xml.schema.util.DatatypeHandler.guessType(DatatypeHand ler.java:188) at org.exolab.castor.xml.schema.util.XMLInstance2SchemaHandler.endElement(X MLInstance2SchemaHandler.java:220) at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unk nown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis patcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unkno wn Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.exolab.castor.xml.schema.util.XMLInstance2Schema.createSchema(XMLIns tance2Schema.java:128) at org.exolab.castor.xml.schema.util.XMLInstance2Schema.createSchema(XMLIns tance2Schema.java:91) at org.exolab.castor.xml.schema.util.XMLInstance2Schema.main(XMLInstance2Sc hema.java:159) Here's a simple XML file to test the error: <PARENT> <CHILD id="CHILD_1"> <INNER id="INNER_25">4295 Mbs</INNER> </CHILD> </PARENT> I created a quick fix to the DatatypeHandler.java by having it ignore IllegalArgumentException's as well as ParseException's when trying to parse a Time. Patch: Index: C:/view_working/workspace/castor/src/main/java/org/exolab/castor/xml/sch ema/util/DatatypeHandler.java =================================================================== --- C:/view_working/workspace/castor/src/main/java/org/exolab/castor/xml/sch ema/util/DatatypeHandler.java (revision 6938) +++ C:/view_working/workspace/castor/src/main/java/org/exolab/castor/xml/sch ema/util/DatatypeHandler.java (working copy) @@ -189,6 +189,7 @@ return TIME_TYPE; } catch(ParseException px) {} + catch(IllegalArgumentException ex) {} //-- check for dateTime DateFormat df = null; ~Doug Daniels --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email