Thanks Cezar. I was able to generate the necessary output using GDateBuilder.
Anirban On Sat, Oct 10, 2009 at 2:32 AM, Cezar Andrei <cezar.and...@oracle.com> wrote: > Anirban, > > > > Did you look at GDateBuilder, specifically at using normalizeToTimeZone > methods? > > > > Cezar > > > > ________________________________ > > From: Anirban Mukherjee [mailto:amukh...@gmail.com] > Sent: Saturday, September 12, 2009 3:12 PM > To: user@xmlbeans.apache.org > Subject: Output dateTime in canonical form > > > > I wish to generate xml output where xs:dateTime values will be generated in > the canonical form rather than the natural form > > e.g. instead of 2009-10-13T01:11:17+05:30, I need 2009-10-12T19:41:17Z > (converted to UTC with Z indicating that it is UTC) > > Is there a straightforward way to achieve this ? > > The GDate class has a canonicalString() method that produces the form I > need, but the toString() produces the natural form. > > Note: If input xml contains dateTime values in the canonical form, they are > processed properly. > > As an experiment, I tried to inherit a subclass from GDate with the intent > of overriding toString() to invoke super.canonicalString() but the GDate > class is final and hence cannot be extended. > But even that would probably not have worked as the XmlDateTime would > probably not care about the canonical form. Refer below... > [ > GDate gdt = new GDate(cal); > XmlDateTime dt = XmlDateTime.Factory.newInstance(); > dt.setGDateValue(gdt); > sig.xsetExpirationDateTime(dt); > ... > ... > doc.save... > ] > > Any help would be appreciated. > > > Thanks, > Anirban --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org For additional commands, e-mail: user-h...@xmlbeans.apache.org