I have this XML:
....
....
<createDate>2009-05-19T07:40:00</createDate>
....
....
When I try to convert to the object using xml-to-object-transformer I got
this exception:
oot Exception stack trace:
com.thoughtworks.xstream.converters.ConversionException: Cannot parse date
2009-05-19T07:40:00
---- Debugging information ----
class : com.vangenechten.system.edi.model.DelForHeader
required-type : java.util.Date
path :
/com.vangenechten.system.edi.model.DelForHeader/createDate
line number : 6
-------------------------------
at
com.thoughtworks.xstream.converters.basic.DateConverter.fromString(DateConverter.java:52)
at
com.thoughtworks.xstream.converters.SingleValueConverterWrapper.fromString(SingleValueConverterWrapper.java:31)
at
com.thoughtworks.xstream.converters.SingleValueConverterWrapper.unmarshal(SingleValueConverterWrapper.java:39)
at
com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:56)
at
com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:45)
at
com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:46)
at
com.thoughtworks.xstream.annotations.AnnotationReflectionConverter.unmarshallField(AnnotationReflectionConverter.java:66)
Is there a way to set the format or locale to avoid this problem?
Thank you,
Patrick Santana
--
View this message in context: http://www.nabble.com/xml-to-object-transformer-tp23943557p23943557.html
Sent from the Mule - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
The xstream site talks about the joda classes which is a jar file full of
date time code available on sourceforge.
ISO8601GregorianCalendarConverter provides a huge collection of formats for
translation, but it isn't active by default.
HTH
import org.mule.api.transformer.TransformerException;
import org.mule.module.xml.transformer.XmlToObject;
import
com.thoughtworks.xstream.converters.extended.ISO8601GregorianCalendarConverter;
/**
* You must have the joda jar file in the classpath for this to work.
* @author dyh
*
*/
public class SoapMessageConverter extends XmlToObject {
public SoapMessageConverter()
{
super();
try {
getXStream().registerConverter(new ISO8601GregorianCalendarConverter());
} catch (TransformerException e) {
throw new RuntimeException("unable to get xstream " +
"in converter constructor "+e.getMessage());
}
}
}
--
View this message in context: http://www.nabble.com/xml-to-object-transformer-tp23943557p23944862.html
Hi, later Mule versions allow for better customization of this transformer. Anyway, could you please file a jira so we can consider this library for inclusion in the OOTB distribution?
Thanks!
Andrew
} } } patricksan wrote: > > Dear All, > > I have this XML: > .... > .... > <createDa...
View this message in context: http://www.nabble.com/xml-to-object-transformer-tp23943557p23944862.html
Sent from the Mule - User mailing list archive at Nabble.com. ------------------------------------...
Andrew Perepelytsya wrote:
>
> Hi, later Mule versions allow for better customization of this
> transformer.
> Anyway, could you please file a jira so we can consider this library for
> inclusion in the OOTB distribution?
>
> Thanks!
> Andrew
>
--
View this message in context: http://www.nabble.com/xml-to-object-transformer-tp23943557p23957095.html
Sent from the Mule - User mailing list archive at Nabble.com.
getXStream().registerConverter(new ISO8601GregorianCalendarConverter()
it does not work. It has the same exception. So I changed it to
getXStream().registerConverter(new ISO8601DateConverter());
and it works.
Thank you all,
Patrick
--
View this message in context: http://www.nabble.com/xml-to-object-transformer-tp23943557p23957834.html