Index: src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBTypeSG.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBTypeSG.java,v
retrieving revision 1.14
diff -u -r1.14 JAXBTypeSG.java
--- src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBTypeSG.java	20 Apr 2005 19:30:15 -0000	1.14
+++ src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBTypeSG.java	26 Apr 2005 13:30:31 -0000
@@ -292,15 +292,10 @@
       if (!pController.isComplex()) {
         Object o = pController.getSimpleTypeSG().getInitialValue(pSource);
         if (o == null && pDefaultValue != null) {
-          if (runtimeType.equals(StringSG.STRING_TYPE)) {
-            o = "\"" + pDefaultValue + "\"";
-          }
-          else {
-            o = pDefaultValue;
-          }
+            o = pController.getSimpleTypeSG().getCastFromString(pDefaultValue);
         }
         if (o != null) {
-          jf.addLine(o);
+            jf.addLine(o);
         }
       }
       return jf;
Index: src/jaxme/org/apache/ws/jaxme/generator/types/AtomicTypeSGImpl.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/AtomicTypeSGImpl.java,v
retrieving revision 1.3
diff -u -r1.3 AtomicTypeSGImpl.java
--- src/jaxme/org/apache/ws/jaxme/generator/types/AtomicTypeSGImpl.java	8 Apr 2005 23:10:45 -0000	1.3
+++ src/jaxme/org/apache/ws/jaxme/generator/types/AtomicTypeSGImpl.java	26 Apr 2005 13:30:31 -0000
@@ -33,6 +33,7 @@
 import org.apache.ws.jaxme.js.TypedValue;
 import org.apache.ws.jaxme.js.impl.TypedValueImpl;
 import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
 import org.xml.sax.SAXException;
 
 
@@ -58,6 +59,24 @@
     return atomicTypeSG;
   }
 
+   public TypedValue getCastFromString(SimpleTypeSG pController, String pValue)
+			throws SAXException {
+		try {
+			return new TypedValueImpl(new Object[] {
+					"javax.xml.bind.DatatypeConverter",
+					".parse" + getDatatypeName() + "(\"", pValue, "\")" },
+					getDatatypeType());
+		} catch (RuntimeException e) {
+			try {
+				throw new LocSAXException("Failed to convert string value to "
+						+ getDatatypeName() + " instance: " + pValue, getLocator());
+			} catch (Exception e1) {
+				throw new SAXException("Failed to convert string value to "
+						+ getDatatypeName() + " instance: " + pValue);
+			}
+		}
+	}
+  
   public TypedValue getCastFromString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, Object pData) throws SAXException {
 	Object value;
 	if (pData == null) {
Index: src/jaxme/org/apache/ws/jaxme/generator/types/Base64BinarySG.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/Base64BinarySG.java,v
retrieving revision 1.3
diff -u -r1.3 Base64BinarySG.java
--- src/jaxme/org/apache/ws/jaxme/generator/types/Base64BinarySG.java	8 Apr 2005 23:10:45 -0000	1.3
+++ src/jaxme/org/apache/ws/jaxme/generator/types/Base64BinarySG.java	26 Apr 2005 13:30:31 -0000
@@ -48,14 +48,6 @@
   protected String getDatatypeName() { return "Base64Binary"; }
   protected JavaQName getDatatypeType() { return BYTE_ARRAY_TYPE; }
 
-  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
-    try {
-      return new TypedValueImpl(new DatatypeConverterImpl().parseBase64Binary(pValue), byte[].class);
-    } catch (NumberFormatException e) {
-      throw new LocSAXException("Failed to convert string value to Base64Binary: " + pValue, getLocator());
-    }
-  }
-
   public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
     LocalJavaField f = pMethod.newJavaField(BYTE_ARRAY_TYPE);
     f.addLine(pValue);
Index: src/jaxme/org/apache/ws/jaxme/generator/types/BooleanSG.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/BooleanSG.java,v
retrieving revision 1.3
diff -u -r1.3 BooleanSG.java
--- src/jaxme/org/apache/ws/jaxme/generator/types/BooleanSG.java	8 Apr 2005 23:10:45 -0000	1.3
+++ src/jaxme/org/apache/ws/jaxme/generator/types/BooleanSG.java	26 Apr 2005 13:30:31 -0000
@@ -50,8 +50,14 @@
     try {
       return new TypedValueImpl(new DatatypeConverterImpl().parseBoolean(pValue) ? Boolean.TRUE : Boolean.FALSE,
 			  					BOOLEAN_OBJECT_TYPE);
-    } catch (RuntimeException e) {
-      throw new LocSAXException("Failed to convert string value to boolean: " + pValue, getLocator());
-    }
+	} catch (RuntimeException e) {
+		try {
+			throw new LocSAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue, getLocator());
+		} catch (Exception e1) {
+			throw new SAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue);
+		}
+	}
   }
 }
Index: src/jaxme/org/apache/ws/jaxme/generator/types/ByteSG.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/ByteSG.java,v
retrieving revision 1.3
diff -u -r1.3 ByteSG.java
--- src/jaxme/org/apache/ws/jaxme/generator/types/ByteSG.java	8 Apr 2005 23:10:45 -0000	1.3
+++ src/jaxme/org/apache/ws/jaxme/generator/types/ByteSG.java	26 Apr 2005 13:30:31 -0000
@@ -51,8 +51,14 @@
     try {
       return new TypedValueImpl(new Object[]{"((", BYTE_TYPE, ") ", new Byte(new DatatypeConverterImpl().parseByte(pValue)), ")"},
 			  					BYTE_TYPE);
-    } catch (NumberFormatException e) {
-      throw new LocSAXException("Failed to convert byte value to integer: " + pValue, getLocator());
-    }
+	} catch (RuntimeException e) {
+		try {
+			throw new LocSAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue, getLocator());
+		} catch (Exception e1) {
+			throw new SAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue);
+		}
+	}
   }
 }
Index: src/jaxme/org/apache/ws/jaxme/generator/types/DateSG.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/DateSG.java,v
retrieving revision 1.4
diff -u -r1.4 DateSG.java
--- src/jaxme/org/apache/ws/jaxme/generator/types/DateSG.java	8 Apr 2005 23:10:45 -0000	1.4
+++ src/jaxme/org/apache/ws/jaxme/generator/types/DateSG.java	26 Apr 2005 13:30:31 -0000
@@ -16,6 +16,8 @@
  */
 package org.apache.ws.jaxme.generator.types;
 
+import java.util.Calendar;
+
 import org.apache.ws.jaxme.generator.sg.SGFactory;
 import org.apache.ws.jaxme.generator.sg.SchemaSG;
 import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
@@ -40,12 +42,24 @@
   protected String getDatatypeName() { return "Date"; }
   protected Class getFormatClass() { return XsDateFormat.class; }
   
-  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
-    try {
-      return new TypedValueImpl(new DatatypeConverterImpl().parseDate(pValue),
-			  					getDatatypeType());
-    } catch (RuntimeException e) {
-      throw new LocSAXException("Failed to convert string value to date instance: " + pValue, getLocator());
-    }
-  }
+  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue)
+			throws SAXException {
+		try {
+			Calendar calendar = new DatatypeConverterImpl().parseDate(pValue);
+			return new TypedValueImpl(
+					new Object[] { "new java.util.GregorianCalendar("
+							+ calendar.get(Calendar.YEAR) + ","
+							+ calendar.get(Calendar.MONTH) + ","
+							+ calendar.get(Calendar.DAY_OF_MONTH) + ")" },
+					getDatatypeType());
+		} catch (RuntimeException e) {
+			try {
+				throw new LocSAXException("Failed to convert string value to "
+						+ getDatatypeName() + " instance: " + pValue, getLocator());
+			} catch (Exception e1) {
+				throw new SAXException("Failed to convert string value to "
+						+ getDatatypeName() + " instance: " + pValue);
+			}
+		}
+	}
 }
Index: src/jaxme/org/apache/ws/jaxme/generator/types/DateTimeSG.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/DateTimeSG.java,v
retrieving revision 1.5
diff -u -r1.5 DateTimeSG.java
--- src/jaxme/org/apache/ws/jaxme/generator/types/DateTimeSG.java	8 Apr 2005 23:10:45 -0000	1.5
+++ src/jaxme/org/apache/ws/jaxme/generator/types/DateTimeSG.java	26 Apr 2005 13:30:31 -0000
@@ -35,6 +35,7 @@
 import org.apache.ws.jaxme.js.TypedValue;
 import org.apache.ws.jaxme.js.impl.TypedValueImpl;
 import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
 import org.apache.ws.jaxme.xs.util.XsDateTimeFormat;
 import org.xml.sax.SAXException;
 
@@ -56,10 +57,26 @@
     protected Class getFormatClass() { return XsDateTimeFormat.class; }
     public JavaQName getRuntimeType(SimpleTypeSG pController) { return CALENDAR_TYPE; }
 
-    public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
-        return new TypedValueImpl(new DatatypeConverterImpl().parseDateTime(pValue),
-								  getDatatypeType());
-    }
+    public TypedValue getCastFromString(SimpleTypeSG pController, String pValue)
+			throws SAXException {
+		try {
+			Calendar calendar = new DatatypeConverterImpl().parseDate(pValue);
+			return new TypedValueImpl(
+					new Object[] { "new java.util.GregorianCalendar("
+							+ calendar.get(Calendar.YEAR) + ","
+							+ calendar.get(Calendar.MONTH) + ","
+							+ calendar.get(Calendar.DAY_OF_MONTH) + ")" },
+					getDatatypeType());
+		} catch (RuntimeException e) {
+			try {
+				throw new LocSAXException("Failed to convert string value to "
+						+ getDatatypeName() + " instance: " + pValue, getLocator());
+			} catch (Exception e1) {
+				throw new SAXException("Failed to convert string value to "
+						+ getDatatypeName() + " instance: " + pValue);
+			}
+		}
+	}
 
     public TypedValue getCastFromString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, Object pData) throws SAXException {
         boolean mayBeDate;
Index: src/jaxme/org/apache/ws/jaxme/generator/types/DecimalSG.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/DecimalSG.java,v
retrieving revision 1.3
diff -u -r1.3 DecimalSG.java
--- src/jaxme/org/apache/ws/jaxme/generator/types/DecimalSG.java	8 Apr 2005 23:10:45 -0000	1.3
+++ src/jaxme/org/apache/ws/jaxme/generator/types/DecimalSG.java	26 Apr 2005 13:30:31 -0000
@@ -51,10 +51,16 @@
 
   public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
     try {
-      return new TypedValueImpl(new DatatypeConverterImpl().parseDecimal(pValue), DECIMAL_TYPE);
-    } catch (NumberFormatException e) {
-      throw new LocSAXException("Failed to convert string value to BigInteger: " + pValue, getLocator());
-    }
+    	return new TypedValueImpl("new java.math.BigDecimal(\"" + pValue + "\")", DECIMAL_TYPE);
+	} catch (RuntimeException e) {
+		try {
+			throw new LocSAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue, getLocator());
+		} catch (Exception e1) {
+			throw new SAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue);
+		}
+	}
   }
 
   public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
Index: src/jaxme/org/apache/ws/jaxme/generator/types/DoubleSG.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/DoubleSG.java,v
retrieving revision 1.3
diff -u -r1.3 DoubleSG.java
--- src/jaxme/org/apache/ws/jaxme/generator/types/DoubleSG.java	8 Apr 2005 23:10:45 -0000	1.3
+++ src/jaxme/org/apache/ws/jaxme/generator/types/DoubleSG.java	26 Apr 2005 13:30:31 -0000
@@ -49,9 +49,15 @@
 
   public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
     try {
-      return new TypedValueImpl(new Double(new DatatypeConverterImpl().parseDouble(pValue)), getDatatypeType());
-    } catch (NumberFormatException e) {
-      throw new LocSAXException("Failed to convert string value to double: " + pValue, getLocator());
-    }
+    	return new TypedValueImpl(new Double(new DatatypeConverterImpl().parseDouble(pValue)) + "d", getDatatypeType());
+	} catch (RuntimeException e) {
+		try {
+			throw new LocSAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue, getLocator());
+		} catch (Exception e1) {
+			throw new SAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue);
+		}
+	}
   }
 }
Index: src/jaxme/org/apache/ws/jaxme/generator/types/DurationSG.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/DurationSG.java,v
retrieving revision 1.4
diff -u -r1.4 DurationSG.java
--- src/jaxme/org/apache/ws/jaxme/generator/types/DurationSG.java	8 Apr 2005 23:10:45 -0000	1.4
+++ src/jaxme/org/apache/ws/jaxme/generator/types/DurationSG.java	26 Apr 2005 13:30:31 -0000
@@ -53,10 +53,16 @@
 
   public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
     try {
-      return new TypedValueImpl(new DatatypeConverterImpl().parseDuration(pValue), DURATION_TYPE);
-    } catch (RuntimeException e) {
-      throw new LocSAXException("Failed to convert string value to dateTime instance: " + pValue, getLocator());
-    }
+    	return new TypedValueImpl("org.apache.ws.jaxme.util.Duration.valueOf(\"" + pValue + "\")", DURATION_TYPE);
+	} catch (RuntimeException e) {
+		try {
+			throw new LocSAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue, getLocator());
+		} catch (Exception e1) {
+			throw new SAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue);
+		}
+	}
   }
 
   public TypedValue getCastToString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, DirectAccessible pData) {
Index: src/jaxme/org/apache/ws/jaxme/generator/types/FloatSG.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/FloatSG.java,v
retrieving revision 1.3
diff -u -r1.3 FloatSG.java
--- src/jaxme/org/apache/ws/jaxme/generator/types/FloatSG.java	8 Apr 2005 23:10:45 -0000	1.3
+++ src/jaxme/org/apache/ws/jaxme/generator/types/FloatSG.java	26 Apr 2005 13:30:31 -0000
@@ -50,8 +50,14 @@
   public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
     try {
       return new TypedValueImpl(new Float(new DatatypeConverterImpl().parseFloat(pValue)) + "f", FLOAT_TYPE);
-    } catch (NumberFormatException e) {
-      throw new LocSAXException("Failed to convert string value to float: " + pValue, getLocator());
-    }
+	} catch (RuntimeException e) {
+		try {
+			throw new LocSAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue, getLocator());
+		} catch (Exception e1) {
+			throw new SAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue);
+		}
+	}
   }
 }
Index: src/jaxme/org/apache/ws/jaxme/generator/types/HexBinarySG.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/HexBinarySG.java,v
retrieving revision 1.3
diff -u -r1.3 HexBinarySG.java
--- src/jaxme/org/apache/ws/jaxme/generator/types/HexBinarySG.java	8 Apr 2005 23:10:45 -0000	1.3
+++ src/jaxme/org/apache/ws/jaxme/generator/types/HexBinarySG.java	26 Apr 2005 13:30:31 -0000
@@ -48,14 +48,6 @@
   protected String getDatatypeName() { return "HexBinary"; }
   protected JavaQName getDatatypeType() { return BYTE_ARRAY_TYPE; }
 
-  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
-    try {
-      return new TypedValueImpl(new DatatypeConverterImpl().parseHexBinary(pValue), BYTE_ARRAY_TYPE);
-    } catch (NumberFormatException e) {
-      throw new LocSAXException("Failed to convert string value to HexBinary: " + pValue, getLocator());
-    }
-  }
-
   public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
     LocalJavaField f = pMethod.newJavaField(BYTE_ARRAY_TYPE);
     f.addLine(pValue);
Index: src/jaxme/org/apache/ws/jaxme/generator/types/IntegerSG.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/IntegerSG.java,v
retrieving revision 1.4
diff -u -r1.4 IntegerSG.java
--- src/jaxme/org/apache/ws/jaxme/generator/types/IntegerSG.java	8 Apr 2005 23:10:45 -0000	1.4
+++ src/jaxme/org/apache/ws/jaxme/generator/types/IntegerSG.java	26 Apr 2005 13:30:31 -0000
@@ -54,7 +54,7 @@
 
   public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
     try {
-      return new TypedValueImpl(new DatatypeConverterImpl().parseInteger(pValue), INTEGER_TYPE);
+    	return new TypedValueImpl("new java.math.BigInteger(\"" + pValue + "\")", INTEGER_TYPE);
     } catch (NumberFormatException e) {
       throw new LocSAXException("Failed to convert string value to BigInteger: " + pValue, getLocator());
     }
Index: src/jaxme/org/apache/ws/jaxme/generator/types/LongSG.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/LongSG.java,v
retrieving revision 1.3
diff -u -r1.3 LongSG.java
--- src/jaxme/org/apache/ws/jaxme/generator/types/LongSG.java	8 Apr 2005 23:10:45 -0000	1.3
+++ src/jaxme/org/apache/ws/jaxme/generator/types/LongSG.java	26 Apr 2005 13:30:31 -0000
@@ -50,8 +50,14 @@
   public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
     try {
       return new TypedValueImpl(new Long(new DatatypeConverterImpl().parseLong(pValue)) + "l", LONG_TYPE);
-    } catch (NumberFormatException e) {
-      throw new LocSAXException("Failed to convert string value to long: " + pValue, getLocator());
-    }
+	} catch (RuntimeException e) {
+		try {
+			throw new LocSAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue, getLocator());
+		} catch (Exception e1) {
+			throw new SAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue);
+		}
+	}
   }
 }
Index: src/jaxme/org/apache/ws/jaxme/generator/types/ShortSG.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/ShortSG.java,v
retrieving revision 1.3
diff -u -r1.3 ShortSG.java
--- src/jaxme/org/apache/ws/jaxme/generator/types/ShortSG.java	8 Apr 2005 23:10:45 -0000	1.3
+++ src/jaxme/org/apache/ws/jaxme/generator/types/ShortSG.java	26 Apr 2005 13:30:31 -0000
@@ -51,8 +51,14 @@
     try {
       return new TypedValueImpl(new Object[]{"((", SHORT_TYPE, ")", new Short(new DatatypeConverterImpl().parseShort(pValue)), ")"},
 			  					SHORT_TYPE);
-    } catch (NumberFormatException e) {
-      throw new LocSAXException("Failed to convert string value to short: " + pValue, getLocator());
-    }
+	} catch (RuntimeException e) {
+		try {
+			throw new LocSAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue, getLocator());
+		} catch (Exception e1) {
+			throw new SAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue);
+		}
+	}
   }
 }
Index: src/jaxme/org/apache/ws/jaxme/generator/types/TimeSG.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/TimeSG.java,v
retrieving revision 1.4
diff -u -r1.4 TimeSG.java
--- src/jaxme/org/apache/ws/jaxme/generator/types/TimeSG.java	8 Apr 2005 23:10:45 -0000	1.4
+++ src/jaxme/org/apache/ws/jaxme/generator/types/TimeSG.java	26 Apr 2005 13:30:31 -0000
@@ -16,6 +16,8 @@
  */
 package org.apache.ws.jaxme.generator.types;
 
+import java.util.Calendar;
+
 import org.apache.ws.jaxme.generator.sg.SGFactory;
 import org.apache.ws.jaxme.generator.sg.SchemaSG;
 import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
@@ -41,11 +43,27 @@
   protected String getDatatypeName() { return "Time"; }
   protected Class getFormatClass() { return XsTimeFormat.class; }
   
-  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
-    try {
-      return new TypedValueImpl(new DatatypeConverterImpl().parseTime(pValue), getDatatypeType());
-    } catch (RuntimeException e) {
-      throw new LocSAXException("Failed to convert string value to time instance: " + pValue, getLocator());
-    }
-  }
+    public TypedValue getCastFromString(SimpleTypeSG pController, String pValue)
+			throws SAXException {
+		try {
+			Calendar calendar = new DatatypeConverterImpl().parseTime(pValue);
+			return new TypedValueImpl(
+					new Object[] { "new java.util.GregorianCalendar("
+							+ calendar.get(Calendar.YEAR) + ","
+							+ calendar.get(Calendar.MONTH) + ","
+							+ calendar.get(Calendar.DAY_OF_MONTH) + ","
+							+ calendar.get(Calendar.HOUR_OF_DAY) + ","
+							+ calendar.get(Calendar.MINUTE) + ","
+							+ calendar.get(Calendar.SECOND) + ")" },
+					getDatatypeType());
+		} catch (RuntimeException e) {
+			try {
+				throw new LocSAXException("Failed to convert string value to "
+						+ getDatatypeName() + " instance: " + pValue, getLocator());
+			} catch (Exception e1) {
+				throw new SAXException("Failed to convert string value to "
+						+ getDatatypeName() + " instance: " + pValue);
+			}
+		}
+	}
 }
Index: src/test/jaxb/defaults.xsd
===================================================================
RCS file: /home/cvs/ws-jaxme/src/test/jaxb/defaults.xsd,v
retrieving revision 1.2
diff -u -r1.2 defaults.xsd
--- src/test/jaxb/defaults.xsd	23 Jul 2004 07:17:57 -0000	1.2
+++ src/test/jaxb/defaults.xsd	26 Apr 2005 13:30:32 -0000
@@ -48,4 +48,59 @@
 	  </xs:sequence>
 	</xs:complexType>
   </xs:element>
+
+  <xs:element name="defaultValuesElt">
+  	<xs:complexType>
+  		<xs:attribute name="string" type="xs:string" default="string" />
+  		<xs:attribute name="boolean" type="xs:boolean" default="true" />
+  		<xs:attribute name="float" type="xs:float" default="1" />
+  		<xs:attribute name="double" type="xs:double" default="1" />
+  		<xs:attribute name="decimal" type="xs:decimal" default="1" />
+  		<xs:attribute name="duration" type="xs:duration"
+  			default="P1D" />
+  		<xs:attribute name="dateTime" type="xs:dateTime"
+  			default="2001-12-31T12:30:30" />
+  		<xs:attribute name="time" type="xs:time" default="12:00:00" />
+  		<xs:attribute name="date" type="xs:date" default="2002-01-01" />
+  		<xs:attribute name="hexBinary" type="xs:hexBinary"
+  			default="0F00" />
+  		<xs:attribute name="base64Binary" type="xs:base64Binary"
+  			default="B64S" />
+  		<xs:attribute name="anyURI" type="xs:anyURI"
+  			default="http://tempuri.org" />
+  		<xs:attribute name="QName" type="xs:QName" default="QName" />
+  		<xs:attribute name="normalizedString"
+  			type="xs:normalizedString" default="" />
+  		<xs:attribute name="token" type="xs:token" default="token" />
+  		<xs:attribute name="language" type="xs:language" default="EN" />
+		<xs:attribute name="NMTOKEN" type="xs:NMTOKEN"
+			default="NMTOKEN" />
+		<xs:attribute name="NMTOKENS" type="xs:NMTOKENS"
+			default="NMTOKENS,NMTOKENS1"/>  		
+  		<xs:attribute name="Name" type="xs:Name" default="Name" />
+  		<xs:attribute name="NCName" type="xs:NCName" default="NCName" />
+  		<xs:attribute name="IDREF" type="xs:IDREF" default="idvalue0" />
+  		<xs:attribute name="integer" type="xs:integer" default="1" />
+  		<xs:attribute name="nonPositiveInteger"
+  			type="xs:nonPositiveInteger" default="-1" />
+  		<xs:attribute name="negativeInteger" type="xs:negativeInteger"
+  			default="-1" />
+  		<xs:attribute name="long" type="xs:long" default="1" />
+  		<xs:attribute name="int" type="xs:int" default="1" />
+  		<xs:attribute name="short" type="xs:short" default="1" />
+  		<xs:attribute name="byte" type="xs:byte" default="1" />
+  		<xs:attribute name="nonNegativeInteger"
+  			type="xs:nonNegativeInteger" default="1" />
+  		<xs:attribute name="unsignedLong" type="xs:unsignedLong"
+  			default="1" />
+  		<xs:attribute name="unsignedInt" type="xs:unsignedInt"
+  			default="1" />
+  		<xs:attribute name="unsignedShort" type="xs:unsignedShort"
+  			default="1" />
+  		<xs:attribute name="unsignedByte" type="xs:unsignedByte"
+  			default="1" />
+  		<xs:attribute name="positiveInteger" type="xs:positiveInteger"
+  			default="1" />
+  	</xs:complexType>
+  </xs:element>
 </xs:schema>
