Re: [Simple-support] Transforming XML schema xs:dateTime type
Brought to you by:
niallg
|
From: Niall G. - Y. <Nia...@yi...> - 2013-01-22 00:05:55
|
I will take a look at adding this to the existing DateTransform, my only reservation is backward compatibility may break in some cases. -----Original Message----- From: Adam Mackler [mailto:sim...@ma...] Sent: Tuesday, 22 January 2013 10:18 AM To: sim...@li... Subject: Re: [Simple-support] Transforming XML schema xs:dateTime type 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 ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122412 _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |