Re: [Simple-support] Transforming XML schema xs:dateTime type
Brought to you by:
niallg
|
From: Adam M. <sim...@ma...> - 2013-01-21 23:35:53
|
FWIW, this blows my mind. My impression from reading the W3C XML Schema specification Part 2, section 3.2.7[1] is that there is a standardized format for date-time values. Wouldn't that format be the obvious choice for serializing java.util.Date objects? As it is, W3C-schema based XML validators will reject Date values serialized by the Simple Framework. That I need to "write a Transformer" to get the Simple Framework to produce XML that complies with the W3C Schema specification brings several words to my mind, none of which is "simple." [1] http://www.w3.org/TR/xmlschema-2/#dateTime On 2011-08-02 09:44, Niall Gallagher <gallagher_niall@ya...> wrote: > You need to write a Transformer to handle this as an attribute. There are examples in the tutorial and in the test cases. > > --- On Mon, 1/8/11, Courtney, Phil <Philip_Courtney@...> wrote: > > From: Courtney, Phil <Philip_Courtney@...> > Subject: [Simple-support] Transforming XML schema xs:dateTime type > To: simple-support@... > Received: Monday, 1 August, 2011, 10:25 AM > > We have been using JAXB on workstations and servers to read and write XML documents. We are now trying to use the Simple Framework to read the same XML documents from an Android application (since JAXB is not supported on Android). In JAXB, a XML xs: dateTime type attribute is transformed with a XMLGregorianCalendar class. When I try to use the XMLGregorianCalendar class with the Simple Framework as shown below: @Attribute(required = true) protected XMLGregorianCalendar lastModified; I get the following error: Cannot use @org.simpleframework.xml.Attribute(empty=, name=, required=true) to represent protected javax.xml.datatype.XMLGregorianCalendar. How can I use the Simple Framework to work with a xs:dateTime attribute? Since this is one of the built-in types, it seems like it should be straightforward. I tried using GregorianCalendar, but that class could not parse the time part. Thanks,Phil > -- Adam Mackler |